RE: [PHP] web page expired
| From: | hadi | Date: | Tue, 17 Jun 2014 17:26:25 +0000 |
| Subject: | RE: [PHP] web page expired | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323494@lists.php.net to get a copy of this message | ||
> As was mentioned in the other thread, this header (and it should really be
> 'Location' instead of 'location') requires an absolute URL. It can work
> with a
> relative one, but may produce inconsistent results. Also, you can only use it if
> there's been no output at all sent to the browser in this session. That means
> not even a single space or new line.
>
> You can test if it's ok to redirect using the headers_sent() function
Ash,
Here is my php code. I don’t know where shell I use it in my code, I mean where to place it in the
code can you please help here.
When the user click back button from page4.php to page3.php web page expired happen, so where to
place the redirection ?
Test2.php
<html>
<body>
<form action="test3.php" method="post">
Username: <br><input type="text" name="username"></br>
<input type="submit" name = 'submit1' value= 'Login'>
</form>
</body>
</html>
Test3.php
<?php
session_start();
?>
<html>
<body>
<?php
$username = $_POST['username'];
$_SESSION['username']= $_POST['username'];
echo "<br> Hi $username.</br>";
?>
<form action="test4.php" method="post">
<input type="submit" name = 'submit' value= 'click me'>
</form>
</body>
</html>
Test4.php
<?php
session_start();
$username = $_SESSION['username'];
echo "<br> Hi $username.</br>";
?>
> On Mon, 2014-06-16 at 04:41 +0300, hadi wrote:
> > How to redirect the user in web page expired can someone give me
> > example where to place the redirect code ?
> >
> > my code
> >
> > header("location:logout.php");
> >
> > thanks.
> >
>
> As was mentioned in the other thread, this header (and it should really be
> 'Location' instead of 'location') requires an absolute URL. It can work
> with a
> relative one, but may produce inconsistent results. Also, you can only use it if
> there's been no output at all sent to the browser in this session. That means
> not even a single space or new line.
>
> You can test if it's ok to redirect using the headers_sent() function
>
> --
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
Attachment: [application/pkcs7-signature] smime.p7s
Attachment: [application/pkcs7-signature] smime.p7s