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.pull/22926/head^2
parent
260576c235
commit
54ac1ea02e
|
@ -10,7 +10,7 @@ localeTitle: Conditionals
|
||||||
|
|
||||||
```PHP
|
```PHP
|
||||||
<?php
|
<?php
|
||||||
if ($_GET['name'] = "freecodecamp"){
|
if ($_GET['name'] == "freecodecamp"){
|
||||||
echo "You viewed the freeCodeCamp Page!";
|
echo "You viewed the freeCodeCamp Page!";
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -19,9 +19,9 @@ localeTitle: Conditionals
|
||||||
|
|
||||||
```PHP
|
```PHP
|
||||||
<?php
|
<?php
|
||||||
if ($_GET['name'] = "freecodecamp"){
|
if ($_GET['name'] == "freecodecamp"){
|
||||||
echo "You viewed the freeCodeCamp Page!";
|
echo "You viewed the freeCodeCamp Page!";
|
||||||
} elseif ($_GET['name'] = "freecodecampguide"){
|
} elseif ($_GET['name'] == "freecodecampguide"){
|
||||||
echo "You viewed the freeCodeCamp Guide Page!";
|
echo "You viewed the freeCodeCamp Guide Page!";
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -30,9 +30,9 @@ localeTitle: Conditionals
|
||||||
|
|
||||||
```PHP
|
```PHP
|
||||||
<?php
|
<?php
|
||||||
if ($_GET['name'] = "freecodecamp"){
|
if ($_GET['name'] == "freecodecamp"){
|
||||||
echo "You viewed the freeCodeCamp Page!";
|
echo "You viewed the freeCodeCamp Page!";
|
||||||
} elseif ($_GET['name'] = "freecodecampguide"){
|
} elseif ($_GET['name'] == "freecodecampguide"){
|
||||||
echo "You viewed the freeCodeCamp Guide Page!";
|
echo "You viewed the freeCodeCamp Guide Page!";
|
||||||
} else {
|
} else {
|
||||||
echo "You viewed a page that does not exist yet!";
|
echo "You viewed a page that does not exist yet!";
|
||||||
|
|
Loading…
Reference in New Issue