bobby2guns2003
New Member
Hey, I would I make a php if statement that would do this:
if $forumid = 11 then redirect to www.example.com
if $forumid = 11 then redirect to www.example.com
if ($forumid == 11)
{
header("Location: http://www.example.com");
}
if ($forumid == 11);
{
header("Location: http://www.example.com");
}
No, i was pointing it out so that the thread starter does not have bad code on there site which will cause errors.themoose said:lol, you like picking holes in Tree NC's code, dont you?![]()
![]()
No, it shouldn't. You don't have a semi-colon with functions that have {} like while, if, else etc. Only what's inside the {}robert allen said:The above is your code, should it be this below? (Semi colon at the end of line 1)Code:if ($forumid == 11) { header("Location: http://www.example.com"); }
Code:if ($forumid == 11); { header("Location: http://www.example.com"); }
maybe something like this could work:bobby2guns2003 said:Hey, I would I make a php if statement that would do this:
if $forumid = 11 then redirect to www.example.com
<?php
/* predefined list of available url redirects - could also be array from database*/
$urls=array();
$urls[1]="http://www.google.com";
$urls[2]="http://www.freewebspace.net";
$urls[3]="http://www.deluxnetwork.com";
if(isset($id)){
$url=$urls[$id];
if($url==""){
header("Location: http://www.default.com/");
}
else{
header("Location: $urls[$id]");
}
}
?>
Wow. You know absolutely nothing about PHP syntax, do you?robert allen said:The above is your code, should it be this below? (Semi colon at the end of line 1)Code:if ($forumid == 11) { header("Location: http://www.example.com"); }
Code:if ($forumid == 11); { header("Location: http://www.example.com"); }