Jump to content

$_get


shage

Recommended Posts

$site = $_GET["site"];

if ($site = "all"){
$site ="allsites";
}elseif ($site = "fob"){
$site ="football";
}elseif ($site = "foo"){
$site ="fooseball";
}elseif ($site = "cri"){
$site ="cricket";
}else{
$site = $_GET["site"];
}

 

for some reason no matter what i put for site i get all sites, what am i doing wrong here

Link to comment
https://forums.phpfreaks.com/topic/96192-_get/
Share on other sites

wouldnt it be easier to use a switch instead

 

$site = $_REQUEST[site];

switch ($site) {

case 'all':

    $site = 'all';

    break;

case 'fob':

    $site = 'football';

    break;

case 'foo:

    $site = 'fooseball';

    break;

case 'cri:

    $site = 'cricket';

    break;

}

 

Link to comment
https://forums.phpfreaks.com/topic/96192-_get/#findComment-492414
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.