robert_gsfame Posted September 24, 2009 Share Posted September 24, 2009 I am really confused with this, hope someone could help.. let say i have 2 button in one form, first button i will use to do the submission while the other one will be used to send an email to user's email typed in the textbox..how to do it using javascript?? <form name = " form1" action="POST"> <input type = "submit"> <input type="text" name="user_email"> <input type="button"> </form> What should i do with the button?? Quote Link to comment Share on other sites More sharing options...
Bricktop Posted September 24, 2009 Share Posted September 24, 2009 Hi robert_gsfame, What you are proposing is not possible, there is no way to email form data using Javascript. You would be better off having a checkbox on your form, something like "Email me a copy", then in your PHP code have an if statement which essentially says if checkbox is checked, send email to email address. Hope this helps. Quote Link to comment Share on other sites More sharing options...
Garethp Posted September 24, 2009 Share Posted September 24, 2009 However, you can make it seem like javascript with AJAX - http://www.w3schools.com/Ajax/Default.Asp It's a wonderful tool Quote Link to comment Share on other sites More sharing options...
robert_gsfame Posted September 24, 2009 Author Share Posted September 24, 2009 no...no...no what i mean is that when i press the other button then it goes to another page where i put a mailto script inside the page Quote Link to comment Share on other sites More sharing options...
Bricktop Posted September 24, 2009 Share Posted September 24, 2009 You could give code similar to the below a try: <input type="button" onclick="document.form1.action='page.php'; document.form1.submit();"> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.