-
whats wrong?
whats wrong with the below code? it works fine if $dl='pcgame' but none of the other ones work?
PHP Code:
<?php
$dl = $_GET[dl]
if ($dl ='pcgame') {
header("Location: /pcgame.php");
}elseif($dl='movie'){
header("Location: /pcgame.php");
}elseif($dl='console'){
header("Location: /console.php");
}elseif($dl='albums'){
header("Location: /album.php");
}elseif($dl='applications'){
header("Location: /application.php");
}elseif($dl='ebook'){
header("Location: /ebook.php");
}elseif($dl='adult'){
header("Location: /adult.php");
}else{
echo 'not a valid input';
}
?>
-
-
uhh you need 2 = in there
also if you are getting them from the url you will need $_GET['dl'] instead. not $_ENV
PHP Code:
if ($dl =='pcgame') {
header("Location: /pcgame.php");
}elseif($dl=='movie'){
header("Location: /pcgame.php");
}elseif($dl=='console'){
header("Location: /console.php");
}elseif($dl=='albums'){
header("Location: /album.php");
}elseif($dl=='applications'){
header("Location: /application.php");
}elseif($dl=='ebook'){
header("Location: /ebook.php");
}elseif($dl=='adult'){
header("Location: /adult.php");
}else{
echo 'not a valid input';
}
-
Just adding to what phpman said...
Is used to assign a variable. So if you have:
You are assigning 2 to the variable, which will then return true (or success) and execute that IF statement.
Is the boolean test statement to find out what something equals.