Forum Moderators: coopster
Now, I have created a multiple page form and it works! All the data goes nicely into the database. However, I do need the form to send me an email with the data, so I can take care of the order.
And that does not work any more.
The email will state only the data of the last page. I guess that it does not remember the data from previous pages. Or that I need to refer to it again, or 'GET' it from the database.
How do I do it?
FORM 1:
<form action="step1">
Name: <input type="text" name="uname">
Phone: <input type="text" name="uphone">
Email: <input type="text" name="uemail">
<input type="submit" value="submit">
</form>
Parse data from first form and pass into sencond, e.g.-
FORM 2:
<form action="step2">
<input type="hidden" name="uname" value="John Q. Public">
<input type="hidden" name="uphone" value="555-555-1212">
<input type="hidden" name="uemail" value="jqp@example.tld">
Card Type: <input type="text" name="cardtype">
Card Number: <input type="text" name="cardnum">
<input type="submit" value="submit">
</form>
I would collect the card info on the last step -- get their name, phone, email etc.. ahead of time, and the financial at the end so it isn't floating around cyberspace in hidden form fields.
foreach ($_POST AS $key => $value) {
$_SESSION[$key] = $value;
}
For the e-mail, loop through the session array key/values to build your e-mail message:
dc
I had a single page form, which was quite long.
My colleage suggested to use a multiple page form. In that case, if someone would not fill out completely, I would have the first entered data, which contains the email address. I could then contact them and get the sale anyway. Very good idea!
It is a good idea... I see a lot of carts promoting "1 Page Checkout" as a a feature or imrpovement - but as you've discovered, if they don't complete the form and abandon the cart, you have nothing. I like the idea of getting the cart contents and the user's name and contact info, THEN getting them to enter payment info.
One thing Webber mentioned was writing to the DB after each form "section" is submitted -- this needs to be thought out... Do you want incomplete orders in the ORDERS db ? Do you want to handle them differently, (e.g. a temporary db) ?
Anyway, it does helo with abandonded carts. I have one ecommerce client who routinely calls people and says, "I see you were attempting to checkout and didn't complete the order... Was there a problem? Can I help? " He closes a good number of sales this way.