One Form With Multiple Submit Actions
I have an HTML with three links and a form, and three PHP scripts: send1.php, send2.php, send3.php. 1-Send form one
Solution 1:
It's hard to say without knowing what you're trying to do.
The easiest way would be to add another parameter to your form, and have the form submit to 1 php page which calls one of the other 3 pages depending on the value of that parameter.
You can either add some radio buttons to your form, or add a hidden input and change the value with javascript whenever the user clicks one of the 3 links.
Solution 2:
Perhaps you could submit 3 times using AJAX ? Here is a simple tutorial using jQuery sending 1 form: http://vimeo.com/1392589.
Do it 3 times :
$("form").on("submit", function() {
$.ajax(...) // do the ajax call 1
$.ajax(...) // do the ajax call 2
$.ajax(...) // do the ajax call 3
})
Solution 3:
You can use Javascript for checking which link was clicked
<aid=""name="signup1"href="#signup"onclick="testFunction(signup1)>1-Send form one</a>
<a id="" name="signup2"href="#signup"onclick="testFunction(signup2)>2-Send form two</a>
<a id="" name="signup3"href="#signup"onclick="testFunction(signup3) >3-Send form three</a>
<div id="signup"><formaction="send_form_x.php"><inputid="clickedLink"type="hidden"><inputid=""name=""type="text"><buttontype="submit">Send</button></form></div>
//JavaScript
function testFunction(signup){
document.getElementById("clickedLink").value = signup;
}
Post a Comment for "One Form With Multiple Submit Actions"