SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2012
    Posts
    50
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)

    Form MAILTO not working!!!

    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:
    Code:
    name_f=Ahmed&name_l=Sadman&occupation=Student&email=waseerock99%40gmail.com&tel=&subject=Feedback
    But my code was never supposed to do this kind of odd things. See the form code below:

    Code:
    <form id="contactme" method="post" action="mailto: muhib96@gmx.com?Subject=960GridSystem">
    <fieldset>
    	<legend>Personal Information</legend>
    	<div> 
    		<label for="name_f">First Name</label>
    		<input type="text" name="name_f" id="name_f">
    	</div>
    	<div>
    		<label for="name_l">Last Name</label>
    		<input type="text" name="name_l" id="name_l">
    	</div>
    	<div>
    		<label for="occupation">Occupation</label>
    		<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 
    	</div>
    </fieldset>
    <fieldset>
    	<legend>Contact Information</legend>
    	<div>
    		<label for="email">Email Address</label>
    		<input type="email" name="email" id="email" value="" required>
    	</div>
    	<div>
    		<label for="tel">Telephone</label>
    		<input type="tel" name="tel" id="tel" value="" placeholder="+(code)(number)">
    	</div>
    	<div>
    		<label for="country">Country</label>
    		<select required>
    			<option></option>
    			<option>Bangladesh</option>
    			<option>Pakistan</option>
    			<option>India</option>
    			<option>Myanmaar</option>
    			<option>UK / US</option>
    			<option>Others</option>
    		</select>
    	</div>
    </fieldset>
    <fieldset>
    	<legend>Your Sayings</legend>
    	<div>
    		<label for="subject">Subject</label>
    		<input type="text" id="subject" name="subject" placeholder="Feedback">
    	</div>
    	<div>
    		<label for="message">Message</label>
    		<textarea rows="3" cols="40" required></textarea>
    	</div>
    </fieldset>
    <div class="button">
    	<input type="submit" value="Send Message">
    </div>
    </form>
    Can you please help me?

  2. #2
    SitePoint Guru
    Join Date
    Jan 2007
    Posts
    967
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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.
    http://www.thesitewizard.com/wizards/feedbackform.shtml

    Good luck.
    Michael

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2012
    Posts
    50
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by eruna View Post
    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.
    http://www.thesitewizard.com/wizards/feedbackform.shtml

    Good luck.
    Michael
    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.

  4. #4
    Sploghm bronze trophy Victorinox's Avatar
    Join Date
    Nov 2008
    Posts
    749
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    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

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,833
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    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).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •