You should use post method for forms that change state on the server, that way the user gets a warning. And you should redirect after processing the form to another page.

if($_GET['action']=='submit') {
        INSERT INTO table VALUES (NULL, '$_GET[input]'
        header('Location: ...');
} else {
        <form action="<? PHP_SELF ?>?action=submit" method="POST">
        <input type="text" name="input">
        </form>
}

Matthew Oatham wrote:

Hi,

I am new to PHP and am more used to JSP. My question is - if I submit a form to a php3 page using action=="<? PHP_SELF ?>" for some processing all is well I can see that form data. After the processing the page is redisplayed - but the data originally sent persits (in the request) this can be a pain if the user was to hit the refresh button then the data is submitted to the server again and if for example the php page does an insert into a database then a new row would be created etc...

Is this normal behaviour of php and jsp ? I am not sure but I am noticing it now with php ? Should I be clearing the data from the request somehow after I have done my processing?

Thanks

Matt

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger



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



Reply via email to