Chef-Scott wrote:
if($_GET['variable'] == 54){
header("Location: file-name.php");
die();
}
else
// continue with rest of php script here
Is the whole page conditional? For example, if the whole page will always run EXCEPT when the variable condition is met then you do not need the "else." Just put the code at the top and you're good.
if($_GET['variable'] == 54){
header("Location: file-name.php");
die();
}
// the rest of the page goes here
However, if you want the page to run ONLY if the variable value is not met, then use the else.
if($_GET['variable'] == 54){
header("Location: file-name.php");
die();
}else{
// the rest of the page goes here.
}
If you need to forward to multiple URLs based on the variable, you can use a variable in header().
if($_GET['variable']){
if($_GET['variable'] == '54'){
$gotourl = 'http://url1.com';
}elseif($_GET['variable'] == '62'){
$gotourl = 'http://url2.com';
}
header("Location: $gotourl");
die();
}
ASK ME ANYTHING
I provide personalized help for Coffeecup Users including personal or group training for Site Designer, Web Form Builder and more via Zoom.
Email me at support@uscni.org or call 865-687-7698.
Did you know that Web Form Builder can be used for both simple and complicated forms and that it's not limited to the default fonts and buttons? Take a look at a form we developed for WindowTinting.com.
https://forms.windowtinting.com/forms/w … ppingcart/