Skip to content Skip to sidebar Skip to footer

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:


Solution 3:

You can use Javascript for checking which link was clicked

<a id=""  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"> 
            <form action="send_form_x.php">   
                <input id="clickedLink" type="hidden">
                <input id="" name="" type="text">
                <button type="submit">Send</button>
            </form>
        </div> 

//JavaScript            
function testFunction(signup){
document.getElementById("clickedLink").value = signup;
} 

Post a Comment for "One Form With Multiple Submit Actions"