Fix if statement to use equal to operator instead of assignment operator. (#24524)
Fix if statement to use Double equals (==) instead of Single equal (=) which would overwrite the value of $_GET['name'] variable.
This commit is contained in:
committed by
Randell Dawson
parent
a0cdec9ab1
commit
85b5707305
@ -10,7 +10,7 @@ Los condicionales en PHP se escriben usando la sintaxis `if` , `elseif` , `else`
|
||||
|
||||
```PHP
|
||||
<?php
|
||||
if ($_GET['name'] = "freecodecamp"){
|
||||
if ($_GET['name'] == "freecodecamp"){
|
||||
echo "You viewed the freeCodeCamp Page!";
|
||||
}
|
||||
```
|
||||
@ -19,9 +19,9 @@ Los condicionales en PHP se escriben usando la sintaxis `if` , `elseif` , `else`
|
||||
|
||||
```PHP
|
||||
<?php
|
||||
if ($_GET['name'] = "freecodecamp"){
|
||||
if ($_GET['name'] == "freecodecamp"){
|
||||
echo "You viewed the freeCodeCamp Page!";
|
||||
} elseif ($_GET['name'] = "freecodecampguide"){
|
||||
} elseif ($_GET['name'] == "freecodecampguide"){
|
||||
echo "You viewed the freeCodeCamp Guide Page!";
|
||||
}
|
||||
```
|
||||
@ -30,9 +30,9 @@ Los condicionales en PHP se escriben usando la sintaxis `if` , `elseif` , `else`
|
||||
|
||||
```PHP
|
||||
<?php
|
||||
if ($_GET['name'] = "freecodecamp"){
|
||||
if ($_GET['name'] == "freecodecamp"){
|
||||
echo "You viewed the freeCodeCamp Page!";
|
||||
} elseif ($_GET['name'] = "freecodecampguide"){
|
||||
} elseif ($_GET['name'] == "freecodecampguide"){
|
||||
echo "You viewed the freeCodeCamp Guide Page!";
|
||||
} else {
|
||||
echo "You viewed a page that does not exist yet!";
|
||||
|
Reference in New Issue
Block a user