About us Privacy Disclaimer Contact us
FAQ Help Advertising Feedback
Home Sitemap Search Donate us

  Home > Computer & I'net > Email - Making Forms...

   Browse by title articles:
   What is hot:

Email - Headers

Email - Making Forms

Does The Color of Your Site Matter?
Incoming Mail and PHP
Creating or Recreating Your Website
Top 5 Qualities to Look for in a Search Engine Optimization Program for your Website
Prev articles1234567891011 12 



Email - Making Forms


Computer & I'net articlesEmail - Making Forms

by David Stanley    



Using the previous examples would automatically send an email out when you view the webpage. This is generally not the effect most people are going for. Using a FORM to gather information from the visitor and have it sent to an email is probably the most popular use.

form.html
<html>
<head>
<title> My Test Form </title>
</head>
<body>
Send us an comment about our site!<br />
<form action="process.php" method="post">
Subject for email : <input type="text" name="subject"><br />
Visitor email : <input type="text" name="from"><br />
Message : <textarea name="message" rows="3" cols="40"></textarea><br />
<input type="submit" value="Send the info">
<input type="reset" value="Clear the form">
</form>
</body>
</html>

The ACTION tells the form to send the information gathered to the processing script when the SUBMIT button is clicked. The NAME values will become variables when they reach the processing script. The input information becomes the variable values.

process.php
<?php
$to = "yourplace@somewhere.com";

$headers = "From: " . $from . " ";
$headers .= "Reply-To: " . $from . " ";
$headers .= "Return-Path: " . $from . " ";

if ( mail($to,$subject,$message,$headers) ) {
   echo "The email has been sent!";
   } else {
   echo "The email has failed!";
   }
?>

The $header area has been modified a bit from the previous examples. Since the form is gathering information from the visitor, this will enter the info and add the correct start and ending parts for the 4th mail variable.




-----------------
Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission.





Phone Bill




  Disclaimer | Privacy | Terms of useCopyright © 2004 Nice2know.com