Jump to content

Archived

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

almightyegg

forwarding to a new page

Recommended Posts

how do i forward toa different page from an if()
this should explain:
[code=php:0]
if($mem[clutch] == 0){
//if it does equal 0, forward to visit.php
}else{
//page go's here! (if it equals anything other than 0)
}
[code=php:0]

Share this post


Link to post
Share on other sites
[code]
<?php
if($mem[clutch] == 0){
header("Location: visit.php");
}else{
header("Location: page.php");
}
?>[/code]
pretty sure you could do it that way

Share this post


Link to post
Share on other sites
nope didn't work :( but thanks anyway :)

i think it was because it said header, and i want to forward the page and not adapt header ;)

Share this post


Link to post
Share on other sites
nope that still didn't work....maybe i made an error...
[code=php:0]if($mem[clutch] == 0){
function redirect($time, "$link") {

echo "<meta http-equiv=\"refresh\" content=\"{$time}; url={$link}\" /> ";

}


Redirect(0, "http://www.lordoftheabyss.com/society/visit.php");

}else{
//normal page here
}
[/code]

Share this post


Link to post
Share on other sites
php is case sensative.

[code=php:0]
function redirect($time, $link) {
  echo "<meta http-equiv=\"refresh\" content=\"{$time}; url={$link}\" /> ";
}

if($mem[clutch] == 0) {
  redirect(0, "http://www.lordoftheabyss.com/society/visit.php");
} else {
//normal page here
}
[/code]

ps: The [url=http://php.net/header]header[/url] method is how it is done in php.

Share this post


Link to post
Share on other sites
still get:
Parse error: syntax error, unexpected '"', expecting '&' or T_VARIABLE or T_CONST in /home/lordofth/public_html/society/mysociety.php on line 68

Share this post


Link to post
Share on other sites
[code=php:0]
function redirect($time, $link) {
  echo "<meta http-equiv=\"refresh\" content=\"{$time}\"; url=\"{$link}\" /> ";
}
[/code]

Share this post


Link to post
Share on other sites

×

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.