Peter Fleck wrote:

I have a cgi that creates a form and then receives the output of the form and sends it to a mysql database. It also displays the form information as a preview of what is getting sent to the database.

You can return to the original form with data if you need to correct something via an 'Edit' button. This button also makes sure that nothing gets stored in the database (by deleting the data that was just sent and I know there must be a better way to do that part but it's not my current question).

If the visitor uses the browser 'Back' button to return to the form, their data will be there but the record won't get deleted from the database.

How do I erase all the data from the form if the visitor chooses to use the Back button? I tried the CGI.pm method mentioned in O'Reilly's CGI Programming:

print $dataIn->header( -type => "text/html", -expires => "now");

but that doesn't do it.

I'm wondering if javascript is the answer?

Thanks.

You're making life much too difficult for yourself. The answer lies in not sending the form data until it has been approved by the user. I would recommend you display the data but save its state by any one of the conventional methods (hidden fields, flat file, etc). If the user needs to edit the field, s/he can recall the form with the values inserted from the saved state. If not, you can then send the values to the MySQL database.



-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to