Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > Back option using php
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 3rd July 16:32
umashankari
External User
 
Posts: 1
Default Back option using php



Hello,

Is there any way to restrict the user not to go back once he
submitted the html form ??

Regards,
Uma
  Reply With Quote


 


2 3rd July 16:32
phpmail
External User
 
Posts: 1
Default Back option using php



Javascript, but that can't be relied on.

Are you're trying to avoid the "This page has expired, resubmit?" warning in
IE?

Use header ("Location:") to redirect the user after processing the form:

<?
if (isset ($artist) && isset ($album)) {
$fp = fopen ('list.txt', 'a');
fputs ($fp, "<tr><td>$artist</td><td>$album</td></tr>\r\n");
header ("Location: $PHP_SELF"); exit(); }
?>
<html>
<body>
<table border="1" cellspacing="2">
<tr><td>Artist</td><td>Album</td></tr> <? readfile ('list.txt');
?>
</table>
<br><br>
<form method="post" action="<? echo ($PHP_SELF); ?>">
<p>Artist: <input type="text" name="artist"></p>
<p>Album: <input type="text" name="album"></p>
<p><input type="submit" name="Add" value="Add"></p>
</form>
</body>
</html>

(It would also be best-practice to send a unique token as a hidden field in
each form, so you can reject it if the form gets posted more than once).
  Reply With Quote


 


3 3rd July 16:33
subs
External User
 
Posts: 1
Default Back option using php


There may be, but it would almost certainly be handled client-side. Try looking into Javascript stuff that clears the browser cache or otherwise prohibits back navigation.

Edward Dudlik
"Those who say it cannot be done
should not interrupt the person doing it."

wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU

----- Original Message -----
From: "Uma Shankari T." <umashankari@lantana.tenet.res.in>
To: "PHP" <php-general@lists.php.net>
Sent: Friday, 17 October, 2003 05:20
Subject: [php] Back option using php

Hello,

Is there any way to restrict the user not to go back once he
submitted the html form ??

Regards,
Uma

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  Reply With Quote
Reply


Thread Tools
Display Modes




666