I have a form that has 2 buttons on it. 1 will send a email using a .php script,and another will submit the form to a .php database. Both of these work great by themselves, but I would like to combine them into 1 button. here is a example of my code:
<FORM name="drop_list" action="<?php echo $editFormAction; ?>"" method="POST" >
<input name="emailForm" type="button" id="emailForm" onClick="sendFormEmail()" value="Email">
<input name="add_patient" type="submit" id="add_patient" onclick=document.drop_list.action='<?php echo $editFormAction; ?>' value="Add Patient">
Here is the java script that is run for the email button:
function sendFormEmail() //email form
{
document.drop_list.action = "html_form_send.php";
document.drop_list.target = "_blank";
document.drop_list.submit(); // Submit the page
return true;
}
I am still very new to php script and javascript, so any help is appreciated.