I have three separate buttons in html. Each button is representing one form. I want to know how to execute a different php action=“phpfile.php” for each button press.
<form name="form1" action="php1.php" method="post">
<input type="button" name="php1" value="php1" onclick="php1()" />
<form name="form2" action="php2.php" method="post">
<input type="button" name="php2" value="php2" onclick="php2()" />
<form name="form3" action="php3.php" method="post">
<input type="button" name="php3" value="php3" onclick="php3()" />
[U][B][I][COLOR="#FF0000"]Call PHP site1?[/COLOR][/I][/B][/U]
[U][B][I][COLOR="#FF0000"]Call PHP site2?[/COLOR][/I][/B][/U]
[U][B][I][COLOR="#FF0000"]Call PHP site3?[/COLOR][/I][/B][/U]
If you want to submit the form data to a php script depending on which button was pressed then you don’t need 3 functions. You can do it with just 1 function. In the form’s onsubmit event handler just change the value of the form’s action attribute to the correct value for the pressed button before submitting the form.
I would like to use three separate forms instead of a Submit button. Is this possible?
You’re not making sense because of course you can have as many forms as you like, each with their own submit button to submit only the form the pressed button is in.
Oh and like i said above, it is possible to use three different submit forms, just use hidden fields for the values you need.