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?? Link to comment https://forums.phpfreaks.com/topic/175338-2-button-in-1-form/ 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. Link to comment https://forums.phpfreaks.com/topic/175338-2-button-in-1-form/#findComment-924021 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 Link to comment https://forums.phpfreaks.com/topic/175338-2-button-in-1-form/#findComment-924022 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 Link to comment https://forums.phpfreaks.com/topic/175338-2-button-in-1-form/#findComment-924139 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();"> Link to comment https://forums.phpfreaks.com/topic/175338-2-button-in-1-form/#findComment-924149 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.