|  | Posted by Philip Ronan on 11/14/05 14:08 
"John" wrote:
 > I have a page that requests an index number from the user using a
 > form. The submit then calls itself and a php lookup table determines
 > the web page required and then does a jump.
 >
 > echo "<script>window.location.href='$a'</script>";
 
 Don't use Javascript to redirect. Use a Location header instead:
 
 <?php
 header("Location: $a");
 ?>
 
 If PHP refuses to do that and says something like "headers already sent",
 then visit http://php.net/header and read it very carefully.
 
 > Details of the page are passed in the address line and pulled off with
 > POST. All works fine no problems,
 
 Why are you using POST? Based on your description, I think GET would be more
 suitable in this case. Some browsers object to being returned to a POST form
 because the data is no longer valid once it has been sent. Perhaps you also
 need to sit down and read RFC2626: http://www.faqs.org/rfcs/rfc2616.html
 
 > However if the user hits the back button the jump is made again and
 > the page they are on simply reloads, as you would expect.
 
 That's only what I would expect from a lame Javascript redirect :-/
 
 --
 phil [dot] ronan @ virgin [dot] net
 http://vzone.virgin.net/phil.ronan/
  Navigation: [Reply to this message] |