PDA

View Full Version : need help in submitting form data



gurmeet
04-12-2010, 07:58 AM
hi,
i have a bloging form. when a user enter his blog into textbox and submit it the goes to the server and saved on server database and goes to another page, u can say the page is (showBlog.php)...


but my problem is this if a user presses refresh button, the data is again submitted and fed into database...

data fed as many times as user presses refresh button...


plz suggest me how to prevent this data to b fed twice in database...

THanks in advanced

prasanthmj
04-15-2010, 05:28 PM
1. After successful processing, redirect the user to a thanks page rather than displaying a message from the form processor.
In PHP, for example:
header( "Location: $thankyouurl" );

2. Validate the submission based one some unique field (like the email address)

bluewalrus
04-15-2010, 05:54 PM
Have it all on one page. Use isset



if (isset($_POST['something')) {
//check inputs then process form then display thanks page code.
} else {
}

For a more detailed answer post code.

http://php.net/manual/en/function.isset.php

Oh this was a javascript post... nevermind then unless you can use php..

gurmeet
04-19-2010, 07:44 AM
dear, i already had used isset() function in PHP...


but the problem is this, after submitting form , when i press refresh button, a alertbox comes and asks
this page cannot be refreshed without resending the informationclick retry to resend the information when i click on retry it submits the data again (duplicates the data in database)
when i click on cancel button it shows a error page " that page cannot be displayed"



the main thing what i want is to cancel the refresh action