Form to mail
using library script

Here is an example of a form-to-mail script. The user fills in these boxes, presses submit, and the results are e-mailed to the recipient specified in the script.

The two important lines in the script that do this are:

<form method="post" action="">
<input type=hidden name="recipient" value="">

Return E-mail
Business Name
Phone Number
Bogus credit card number
Contact Name
Phoney Phone Number

If you are going to specify a recipient with a domain name that we are hosting (ex. <input type=hidden name="recipient" value="you@yourdomain.ext"> ) then you need to advise us of this, so that we can allow the library script to send email to your domain. This is a security requirement that prevents unauthorized use of this script. We cannot add a domain name that we do not host to the allowed names list.

Here is a complete HTML listing of the script to create the above form.

Test of form to mail
<form method="post" action="" name="test1">
<input type=hidden name="recipient" value="youremail@yourdomain.ext"> <!-- put your email address there -->
<input type=hidden name="subject" value="Test of Form to Mail script">
<td align=right>Return E-mail</td><td><input type="text" name="email" size="20"></td>
<td align=right>Date</td><td><input type="text" name="date" size="8"></td>
<td align=right>Business Name</td><td><input type=text name="business_name" size="30"></td>
<td align=right>Phone Number</td><td><input type=text name="main_number" size="15"></td>
<td align=right>Bogus credit card number</td><td><input type=text name="account_number" size="6"></td>
<td align=right>Contact Name</td><td><input type=text name="contact_name" size="20"></td>
<td align=right>Phoney Phone Number</td><td><input type=text name="cbr_phone_number" size="15"></td>
<td colspan=2>
Comments:<br><textarea name="Comments" rows="10" cols="60"></textarea>
<td colspan=2 align=center>
<input type="submit" name="SubmitButton" value="Submit"> <input type="reset" value="Reset">

Some other hidden attributes that you can include:

<input type="hidden" name="return_link_url" value="http://www.your.domain/yourform.html" />

This specifies a return link at the bottom of the default confirmation page.

<input type="hidden" name="return_link_title" value="Link back to form" />

This specifies the text to the link above.

<input type="hidden" name="redirect" value="http://www.your.domain/foo.html" />

This specifies a custom confirmation page that replaces the default page.

©2004, 2005 Rick McEntire