PDA

View Full Version : form action do 2 things?


desertdirk
01-26-2006, 12:13 AM
Is it possible for the form action =
tag to do 2 things? When a submit button is clicked I want the form to action to go to another page and to send an email message at the same time

Thanks
dd

Creative Insanity
01-26-2006, 12:16 AM
Search the forums DJ has answered this one before.

desertdirk
01-26-2006, 12:43 AM
searched but didn't come up with anything relevant. Can you point me somewhere?
thanks

davidj
01-26-2006, 09:33 AM
submit the form using javascript

change your submit button to a standard button and add...

onClick="submiter()" to the input tag

<input type="button" name="Button" value="Button" onClick="submiter()">

now your JS function...

function submiter(){

document.form1.submit();

////////////////////////////////////////////////////////////////////
////////add your email script here or call in an include///////
////////////////////////////////////////////////////////////////////

}

desertdirk
01-26-2006, 03:14 PM
Ah
ok that will do the trick. So the form action still goes to the next page or what ever and the javascript preforms the other action.
Thanks dj
DD

davidj
01-26-2006, 05:25 PM
you can leave your action attribute blank and set it in JS if you want

document.form1.action="process_page.php";
document.form1.submit();

i do this all the time coz it means i can have different actions for different senarios