Jump to content


Photo

forwarding to a new page


  • Please log in to reply
7 replies to this topic

#1 almightyegg

almightyegg
  • Members
  • PipPipPip
  • Advanced Member
  • 791 posts
  • LocationEngland

Posted 23 October 2006 - 09:34 PM

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]
Visit my Game - Under Construction

#2 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 23 October 2006 - 09:41 PM

<?php
if($mem[clutch] == 0){
header("Location: visit.php");
}else{
header("Location: page.php");
}
?>
pretty sure you could do it that way


#3 almightyegg

almightyegg
  • Members
  • PipPipPip
  • Advanced Member
  • 791 posts
  • LocationEngland

Posted 23 October 2006 - 09:45 PM

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 ;)
Visit my Game - Under Construction

#4 fert

fert
  • Members
  • PipPipPip
  • Advanced Member
  • 1,114 posts

Posted 23 October 2006 - 09:53 PM

http://www.phpfreaks...edirect/532.php

Si hoc legere scis nimium eruditionis habes
Gentoo Linux 2007.0 Firefox 2

#5 almightyegg

almightyegg
  • Members
  • PipPipPip
  • Advanced Member
  • 791 posts
  • LocationEngland

Posted 23 October 2006 - 10:18 PM

nope that still didn't work....maybe i made an error...
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
}

Visit my Game - Under Construction

#6 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 23 October 2006 - 10:21 PM

php is case sensative.

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
}

ps: The header method is how it is done in php.

#7 almightyegg

almightyegg
  • Members
  • PipPipPip
  • Advanced Member
  • 791 posts
  • LocationEngland

Posted 23 October 2006 - 10:23 PM

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
Visit my Game - Under Construction

#8 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 23 October 2006 - 10:25 PM

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users