On Fri, 17 Oct 2003 14:50:21 +0530 (IST), you wrote:

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

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).

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

Reply via email to