Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question mailto function not working with submit button

    Hello,

    I have a form that when it is filled out by a user it is then updated in a database, what i would like is for that information to be sent via email at the same time. Ive tried the mailto function but doesnt seem to work

    my code is:

    <input type="Submit" name="SubmitButton" id="SubmitButton" value="Submit" onclick="mailto:xxxxx@xx.com"/>


    any help would be appreciated

    thanks

  • #2
    Regular Coder mbaker's Avatar
    Join Date
    Jan 2010
    Location
    Burford, Oxfordshire, United Kingdom
    Posts
    249
    Thanks
    1
    Thanked 39 Times in 39 Posts
    Quote Originally Posted by Cheryl399 View Post
    I have a form that when it is filled out by a user it is then updated in a database, what i would like is for that information to be sent via email at the same time. Ive tried the mailto function but doesnt seem to work

    my code is:

    <input type="Submit" name="SubmitButton" id="SubmitButton" value="Submit" onclick="mailto:xxxxx@xx.com"/>
    Even if the mailto on your submit button does work, it won't take the values from your form. To do that it would need to be given as the action for the form. However as you already must have an action for your form to send the data to your database it is not going to be possible to have the form also send the data by email.

    In any event, given the patchy response you will get when using mailto it is probably advisable to avoid using it. [mailto depends upon at least both the browser being set up to respond to mailto and the user clicking on send when their email client pops up with a mail message]

    If you want the information to be also emailed to you, it would be better to modify the server side script that places the information into the database.

    If you don't have access to that script, it might be possible to set up an intermediate script that sends the email and sends the data to the original script. However I've never done that, and don't know if it could be implemented in practice.
    - Michael Baker - HTML Tags Guide - Reference and Tutorials
    - Like voting, validate early, validate often - W3C HTML Validator - W3C CSS Validator
    - Wot? me cynical? no, its just if you vote, er, validate early, you have more chance of validating often.


  •  

    Posting Permissions

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