HTMLGoodies
The ultimate html resource
Earthweb.com


About the Double-Underlined Links


Become a Partner




Search Clipart.com:



internet.commerce















HTML Goodies : Beyond HTML : PHP: PHP Tutorial: Order Form

HTML GOODIES TO GO NEWSLETTER


Other Related Newsletters

PHP Tutorial: Order Form


By Vince Barnes

We continue now by creating a simple order form.  The processing of forms like this is one of the more common things to be done with server side languages including PHP.  For our example we have chosen the component order form from the Acme Widget Company (of course!)  Here's the code for the entire form:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Acme Widget Company</title>
</head>
<body style="font-family: Arial">
<h1><br>
Acme Widget Company</h1>
<p>Component Order Form</p>

<FORM ACTION="processorder.php" method=post>
<table border=0>
<tr>
<td width=150>Item<br>
&nbsp;</td>
<td width=15>Quantity<br>
&nbsp;</td>
</tr>
<tr>
<td>Bases</td>
<td align="center"><input type="text" name="qtybases" size="3" maxlength="3"></td>
</tr>
<tr>
<td>Stems</td>
<td align="center"><input type="text" name="qtystems" size="3" maxlength="3"></td>
</tr>
<tr>
<td>Tops</td>
<td align="center"><input type="text" name="qtytops" size="3"
maxlength="3"></td>
</tr>
<tr>
<td colspan="2" align="center"><br>
<input type="submit" value="Enter Order"></td>
</tr>
</table>
</form>

</body>
</html>

You can click here to see what this form looks like in your browser.

Now let's break it down.  As with our last example, most of the code you see is ordinary HTML.  Notice, however, that the ACTION= on the FORM statement points to a PHP file called processorder.php (the capitals we've used here are only to highlight to code we're talking about - it doesn't make any difference whether you use capitals or lowercase letters, except that the filename may be case sensitive if your site is hosted on a Unix/Linux system.).

When the user hits the "enter order" button, the file whose name (URL) appears in the ACTION statement will be loaded and the data the user typed into the form elements will be passed to it.  The data will be identified to that file by the field names used on the form, here "qtybases", "qtystems"  and "qtytops".  For this reason it's a good idea to use easily recognized and meaningful names, such as ours are.

There's really no PHP code in this form (which is why it's in a file named with a .html extension) so we'll move right along to the file that will process our order.

Continue to the next part of this Tutorial

Return to the Tutorial Series Index

Tools:
Add htmlgoodies.com to your favorites
Add htmlgoodies.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

IT Management Networking & Communications Web Development Hardware & Systems Software Development Earthwebnews.com

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Symantec Whitepaper: Converging System and Data Protection for Complete Disaster Recovery
Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
  Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Symantec Whitepaper: Comprehensive Backup and Recovery of VMware Virtual Infrastructure
MORE WHITEPAPERS, EBOOKS, AND ARTICLES