Jump to content


Photo

header redirect problem


  • Please log in to reply
2 replies to this topic

#1 vzwhaley

vzwhaley
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 01 March 2006 - 06:44 PM

Can anyone tell me why the following code will not redirect to the page when the recordset is true?

  $sql = "SELECT Username, Pass, Security FROM Admin WHERE Username = '$Username' AND Pass = '$Password'";
  $RS = mysql_query($sql);

  $num = mysql_num_rows($RS);
  
  if ($num != 0) {
  $redirectLoginSuccess = "default.php";
  $_SESSION['Username'] = $RSLogin['Username'];
  $_SESSION['Security'] = $RSLogin['Security'];
  
  header("Location: ".$redirectLoginSuccess);
  
  }


#2 php_b34st

php_b34st
  • Members
  • PipPipPip
  • Advanced Member
  • 168 posts

Posted 01 March 2006 - 07:09 PM

You need to put the location inside the ""

header("Location: $redirectLoginSuccess");


#3 mainewoods

mainewoods
  • Members
  • PipPipPip
  • Advanced Member
  • 685 posts
  • LocationMaine

Posted 02 March 2006 - 01:47 AM

--Sometimes the header requires a fully qualified url to work: [a href=\"http://domainname.com/directory/file.php\" target=\"_blank\"]http://domainname.com/directory/file.php[/a]
--you're safer if you always use a fully qualified url with the header. I'm not sure if this is a browser issue or a server host issue.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users