Have you ever created a form for a website, and as close to a masterpiece as it was, you just couldn't shake that feeling that it was missing something… that spark to make it perfect? Well you WERE missing something; an extra form field on your form! Quantity is directly responsible for quality, right?
Well today we're going to show you how to take that plain Jane, unfinished, and quite frankly unprofessional form, and add one more form field to it into the jet-setting beauty queen about town of a web form we've all come to expect from you.
For this tutorial we are using an eCart form configured to use credit card payments. You in no way need to use eCart for this tutorial, but we will be mentioning specific fields and some cool, advanced topics later on, so if you are following along with different forms, or using an eCart site configured with a different payment gateway setup, take note of the changes.
Optional:
In this step, we're going to add a Company Name field under the customer First and Last name fields. Again, since forms are so subjective, and you could be using a completely different form than we are, or you could be using even a different eCart configuration than we are, these fields may be totally different. Keep that in mind when we mention specific fields.
<input type="text" name="company" id="company" value="">
Next on the chopping block%u2026 or the opposite of a chopping block really since we're adding instead of taking away%u2026 how about; "the nega-chopping block"?
Next on the nega-chopping block, we're going to add a snazzy session variable to store the value of the Company field, so we can later store it in our eCart order info.
Now we're going to take that fancy little session variable we created, and use it to store the company value
<?php echo (isset($_SESSION['eCartCheckoutForm_company'])?$_SESSION['eCartCheckoutForm_company']:""); ?>
Just for fun, let's show the company name value in the Billling Information section of the confirm page
We're getting close, I can taste it! It tastes garlicy, with a hint of lime%u2026
The next step is going to be adding the company the user entered into the order in the database
<?php echo (isset($_SESSION['eCartCheckoutForm_company'])?$_SESSION['eCartCheckoutForm_company']:""); ?>
Your skills at websites are breathtaking. I'm sure you're good at other things too, but let's be honest; the thing that sold me on you was that sharp brain for web things.
Now that you can add an awesome form field and stuff, you can try adding the field value to your email receipts, or just spam their company with emails telling everyone what your client bought (don't really do that last one). The sky is the limit! %u2026 Unless you're an astronaut...
Comments will be sent to the author of this tutorial and may not be answered immediately. For general help from WebAssist, please visit technical support.
Sign in to add commentsYour friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.
phill401410: 10 Years, 7 Months, 4 Days, 21 Hours, 15 Minutes ago
<?php echo (isset($_SESSION['eCartCheckoutForm_company'])?$_SESSION['eCartCheckoutForm_comp?any']:""); ?>
Is there an extra "?" in the second "comp?any"?
Team WebAssist: 10 Years, 7 Months, 4 Days, 18 Hours, 15 Minutes ago
Yes, silly mistake - sorry. Thanks for catching.