Need script for making a guest form

Asked By 150 points N/A Posted on -
qa-featured

I have my form set up to submit to my email address.  When sumbit is clicked outlook express, or whatever default software the guest would have, opens.

I want the form to be able to be sent to me from a an email address that the guest would enter into the form, help please.  

This is the code that I have so far.

<form align= "left" action= "mailto:[email protected]">

Your Name:
<br>
<INPUT type="text" name="Name" value="Not your real name" size="20" maxlength= "50" onfocus=value=''">
<br><br>
Your Email:
<br>
<input type="text" size= "20" maxlength= "50">
<br><br>
Business Name
<br>
<input type="text" size= "20" maxlength= "50">
<br><br>
Business Address:
<br>
<textarea wrap= "virtual" name= "address" rows= 3 cols= 20 maxlength= 100>
</textarea><br><br>
Business Phone #:
<br>
<input type="text" size= "20" maxlength= "12">
<br><br>
Rate Your Experience:
<br>
<select size= "1">
<option> 1
<option> 2
<option> 3
<option> 4
<option> 5
<option> 6
<option> 7
<option> 8
<option> 9
<option> 10
</select>
<br><br>
Describe your experience. <br>
<textarea wrap= "virtual" name= "review" rows= 10 cols= 50 maxlength= 500>
</textarea><br><br>
<input type= "submit" value= "Submit Review">
<input type= "reset" value= "Start Over">
</form>

thanks

SHARE
Best Answer by Harry
Best Answer
Best Answer
Answered By 200 points N/A #162244

Need script for making a guest form

qa-featured

 

Here is the answer. You have to add some properties to the action attribute.
 
The method attribute and enctype attribute. And also you can add a subject for the email message. So here is the modified form element.
 
<form align="left" action="[email protected]?subject=Form Submission" enctype="text/plain" method="post">
 
And remember to use the name attribute in each text boxes, which you want the user to fill information. So here is the completed code working perfectly.
 
<html>
 
<body>
 
<form align="left" action="mailto:@live.com?subject=Form Submission" enctype="text/plain" method="post">SomenameYour Name:
 
<br>
 
<INPUT type="text" name="Name" size="20" maxlength= "50" onfocus=value=''">
 
<br><br>
 
Your Email:
 
<br>
 
<input type="text" size= "20" maxlength= "50" name="Email">
 
<br><br>
 
Business Name
 
<br>
 
<input type="text" size= "20" maxlength= "50" name="Business Name">
 
<br><br>
 
Business Address:
 
<br>
 
<textarea wrap= "virtual" name= "Business Address" rows= 3 cols= 20 maxlength= 100>
 
</textarea><br><br>
 
Business Phone #:
 
<br>
 
<input type="text" size= "20" maxlength= "12" name="Business Phone">
 
<br><br>
 
Rate Your Experience:
 
<br>
 
<select size= "1" name="Rating">
 
<option> 1
 
<option> 2
 
<option> 3
 
<option> 4
 
<option> 5
 
<option> 6
 
<option> 7
 
<option> 8
 
<option> 9
 
<option> 10
 
</select>
 
<br><br>
 
Describe your experience. <br>
 
<textarea wrap= "virtual" name= "Review" rows= 10 cols= 50 maxlength= 500>
 
</textarea><br><br>
 
<input type= "submit" value= "Submit Review">
 
<input type= "reset" value= "Start Over">
 
</form></body>
 
</html>
 
 
 
When you click the Submit Review button after filling the form, the output of this code will be follow.
 
 
 
 
Subject : Form Submission
 
Name=Harry
Email=harry444 at gmail.com
Business Name=Harry Browns
Business Address=No 34, Armand Street,
London.
 
Business Phone=9999999999
Rating=4
Review=none
 
I think your problem is now solved. Also in mailto function you can add :
 
multiple recipients by separate the email addresses by using a comma
 
 
Carbon Copy (CC) field
 
 
Blind Carbon Copy (BCC) field
 
 
additional Body part
 
"mailto:[email protected]?body= User Profile Information is here by attach with”
 
You can use %0A for a new line
 
Or use %0A%0A for a new line lead by a blank line.
 
For example
 
“mailto: [email protected]?body=1st paragraph of the message.%0A%0A2nd paragraph of the message.%0A%0A3rd paragraph of the message."
 
Facts to remember
 
Double quotes are required if you are using any spaces in your message body.
 
mailto parameter must be leaded by a question mark and a ampersand mark for second and further more parameters.
 
Most experts recommended using a process other than a mailto function to handle the e-mail process from your web site. It is prefer to use some other kind of scripting language to create that process. And avoid using it in the action attribute.
 
But if you really want to use mailto function, then encode the email address (use enctype attribute).
 
The enctype attribute defines before sending data to the server how the form data should be encoded.
 
Default value for this is application/x-www-form-urlencoded
 
Means that before data are sent to the server, all the characters are encoded
 
Spaces converted to + symbols
 
Special characters converted to ASCII HEX values.
 
What we use in here is text/plain which means :
 
Spaces converted to + symbols, but special characters are not encoded.
 
The other value is multipart/form-data.
 
It says no characters are encoded. (This is required to use when you are using forms which have a file upload control)
 
It is not a good idea to send a form data through email using mailto action as it is not reliable.
 
You can think this mechanism is great, but depending on the mail client, what is installed on their computer the output can be different. But this code works fine in Outlook express.

Related Questions