View Full Version : Add preview to form submission

12-23-2008, 07:18 AM
I've created a form that uses a php formailer and is hosted on a Linux server. It works great for submitting information to my database, emailing me and sending them to another URL when completed. I'm using it for a registration page. However, now as it's been up for several weeks I'm finding that people hit submit, then change their mind, go back and make a change and submit again. Some people are registering 3 or 4 times. Here's what I'd like to do. When they hit the submit button have a window or something like that open displaying thier currently selected options along with other reigistration info such as name and phone and email etc. In this window they could review thier answers and then either click an "OK" button which actually would act as the submit button now does and then moves them to my payment page and entering the information into my database. Or the option there of "Cancel" which would then close that window and allow them to make a change before doing it again until they're happy and can hit OK. This would solve all my multiple entries I would believe. I've searched all over the internet, but can't seem to find that answer. I've tried adding a "behavior" to the submit button, but I can only see a "Popup" option, but still submits the data through. I'm sure there's a way either with that submit behavior or perhaps a Javascript.
Thanks for any help.

12-23-2008, 04:19 PM
It sounds like they can fill out a form and make payment(s) without
any email validation. That means you really have no control over a person
leaving the site and coming back before they get to the payment page.

Having an intermediate "confirm" form page really does no good. They can still
confirm it and exit your site before they pay anything. You have no idea of
who they are. In effect, they are really not registering.

In most cases, they need to register with a valid email address, username.
You make them view their email to see the temporary password that they can
change once they've returned to your site.

It then follows along these lines ...

Check for a PHP SESSION, if not set,
Let them fill out the form and click submit.

If a SESSION is set, that means they have previously logged-in. Open a form
with their data from the database. They can edit or continue to payment.

If they try to re-register ...
If the email address they use is already taken, that means the person
has already registered, so ask them for a username and password to

If they're visiting the form for the first time ...
Create an ID for them in MySQL and save their info, then start a PHP SESSION at that time.
Go through the operation of validating the email and giving them a temporary password.
Now, the PHP SESSION is their ID and is set.

If they abort before payment, you have their information stored, even if they leave
and come back the next day.

For the email part, you don't have the form sent to you ... you have an email sent
about a "new user" and their ID. You only get one email for each user because it
only gets sent when they register (which can only happen 1 time).