HTML & CSS
I have recently created a form only for my practice. I used MAILTO to send the form data through email. When I click the submit button, Firefox tells me to choose an application between GMAIL and YAHOO. I have chosen GMAIL and it took me to my GMAIL account to send the form. But in the body, something appearing like this:
But my code was never supposed to do this kind of odd things. See the form code below:
<form id="contactme" method="post" action="mailto: email@example.com?Subject=960GridSystem">
<label for="name_f">First Name</label>
<input type="text" name="name_f" id="name_f">
<label for="name_l">Last Name</label>
<input type="text" name="name_l" id="name_l">
<input type="radio" name="occupation" id="occupation" value="Service" checked>Service Holder
<input type="radio" name="occupation" id="occupation" value="Student">Student
<input type="radio" name="occupation" id="occupation" value="Pro">Web Professional
<label for="email">Email Address</label>
<input type="email" name="email" id="email" value="" required>
<input type="tel" name="tel" id="tel" value="" placeholder="+(code)(number)">
<option>UK / US</option>
<input type="text" id="subject" name="subject" placeholder="Feedback">
<textarea rows="3" cols="40" required></textarea>
<input type="submit" value="Send Message">
Can you please help me?
Using a mailto action isn't a good practice for a number of reasons. It is better to send the form values to a backside script like php, perl, or asp that sends the message.
This site should get you started.
Sorry, but I want to know why it won't work? And I don't want to use PHP scripts as I will not be able to customize the form as I want, because I am still not able to understand PHP or PERL.
What do you expect mailto to do? It simply passes the input name and value to the message body. It cannot format the data. For that you need a backend script as eruna has said above.
Read more about mailto here: Newbies Beware! The Mailto: Myth
A mailto link simply opens the defined email program - some browsers might pass info from the form into the email program but there is nothing that requires that they do so and so most don't.
<form action="mailto:... functions identically in most browsers to <a href="mailto:... and the form is effectively ignored.
You don't need to understand a server side language in order to be able to use a server side script to process a form. You just need to obtain an appropriate script and install it. There are plenty of form2mail scripts around and many of them are free to copy and use (including one of the two form2mail scripts that I wrote in PHP).
This topic is now closed. New replies are no longer allowed.