Fix if statement to use equal to operator instead of assignment operator. (#24523)
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
Gregory Gubarev
parent
260576c235
commit
54ac1ea02e
@ -10,7 +10,7 @@ localeTitle: Conditionals
|
||||
|
||||
```PHP
|
||||
<?php
|
||||
if ($_GET['name'] = "freecodecamp"){
|
||||
if ($_GET['name'] == "freecodecamp"){
|
||||
echo "You viewed the freeCodeCamp Page!";
|
||||
}
|
||||
```
|
||||
@ -19,9 +19,9 @@ localeTitle: Conditionals
|
||||
|
||||
```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 @@ localeTitle: Conditionals
|
||||
|
||||
```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