Some PHP and form submission help?

Posted by: hybrid8

Some PHP and form submission help? - 24/10/2006 20:03

I need some help preventing my email form from being rebmitted (generating an email) when the page is reloaded.

Hopefully this can be fixed (and someone can help me do it). Over the past 1.5 weeks I've been working on a shopping cart for my site and a dozen other smaller things so I'm pretty burnt out.

Today I decided to write a small form to email submission page cobbled together from a few bits I found on the net and some of the forms and validation I'd put together for the cart.

The forms is created by the same page it is submitted to. A few conditionals check to see what's going on when the page loads to decide where to go within it (whether it should validate and complain about invalid input or whether to actually do a real submit action and create an email message).

When the thing completes successfully it sends the browser to a brand new page using the "header" function.

Reloading that page says (of course) that post data needs to be resubmitted - and generates a duplicate email.

What's a fairly straight forward way to prevent this? I can send up the source for my PHP page.
Posted by: hybrid8

Re: Some PHP and form submission help? - 24/10/2006 20:26

Ok, nevermind.

It works now. I was printing a bit of text AFTER the header command which was apparently what was holding the form. After remving that (it wasn't supposed to be there), all is well.

Bruno