spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / programming / php / phpemail / 2 To page 1current pageTo page 3To page 4
[previous][next]

Email Forms in PHP

Developer News
Google to Shake Up Browsers With Own Launch
Mozilla's Ubquity Mashup: For The Masses?
iPhone Users Just Want to Have Fun

The Form

Like any email form, the original form itself is quite simple. No great shakes here, just a standard HTML form with a POST method and the action pointing to the PHP page that will process the form results.

<form name="form" method="post" action="contact_thanks.php">
<p class="bodymd">Your Name<br>
<input type="text" name="Name">
</p>
<p class="bodymd">Your Email<br>
<input type="text" name="Email">
</p>
<p class="bodymd">Comments or Questions<br>
<textarea name="Comments" rows="5" cols="40"></textarea>
</p>
<p class="bodymd">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Clear Form">
</p>
</form>

This form can be .html, .shtml or whatever you choose; the page that the results are handed to, however, must be a PHP page.

Processing the Mail

Take a look at the code on the next page. It is very typical of any scripting language, server-side or client-side, so if you have any amount of knowledge in JavaScript, ASP, JSP, Perl or the like, it should seem very familiar.

The code is a combination of validation, and, if validated, the email processor as well. Take a look at the first if statement, it is checking to see if any of the fields are empty. If any one field is, it then opens a form and prints a statement to inform the user that they missed some required field(s).

The statements after that are also simple. "If" statements check each of the individual fields to see if they are empty; if they are empty, the script prints that field again to be filled in (note that the form was already opened above if a field was empty). If it is not empty it then stores the value of that field in a hidden field.

home / programming / php / phpemail / 2 To page 1current pageTo page 3To page 4
[previous][next]



JupiterOnlineMedia

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

Solutions
Whitepapers and eBooks
Intel PDF: Virtualization Delivers Data Center Efficiency
Intel eBook: Managing the Evolving Data Center
Microsoft Article: BitLocker Brings Encryption to Windows Server 2008
Symantec eBook: The Guide to E-Mail Archiving and Management
Microsoft Article: RODCs Transform Branch Office Security
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
Avaya Article: Advancing the State of the Art in Customer Service
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Avaya Article: Avaya AE Services Provide Rapid Telephony Integration with Facebook
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Seminar: Efficiencies in Hardware/Software Virtualization
HP Webcast: Disaster Recovery Planning
Go Parallel Video: Performance and Threading Tools for Game Developers
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
IBM TCO eKIT: Your IT Budget is Under Attack, Get in Control
IBM Energy Efficiency eKIT: Learn How to Reduce Costs
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Microsoft Article: Silverlight Streaming--Free Video Hosting for All
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
HP Demo: StorageWorks EVA4400
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
webref The latest from WebReference.com Browse >
The Partial Function Application in JavaScript · Creating Dynamic RSS Feeds with Ajax · Performance Optimizations for High Speed JavaScript
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Cablevision Deploys More Hotspots for Commuters · Dell Joins the Netbook Movement with its Inspiron Mini 9 · It's Official: Dell Enters the Netbook Fray


Created: July 30, 2001
Revised: July 30, 2001


URL: http://webreference.com/programming/javascript/phpemail/2.html