Hey guys,
Well what I want is to have one form, but two submit buttons. Depending on which submit button is pressed, different code will run.
Here is a short version of my form:
[HTML]<form action="myform. php" method="POST">
<input name="var1" type="text" value="0" size="7" maxlength="6" />
<input name="var2" type="text" value="0" size="7" maxlength="6" />
<input name="var3" type="text" value="0" size="7" maxlength="6" />
<input name="var4" type="text" value="0" size="7" maxlength="6" />
<input name="recruit" type="submit" value="Recruit" />
<input name="disband" type="submit" value="Disband" />
</form>
[/HTML]
The php check:
[PHP]if ( $_SERVER['REQUEST_METHOD '] == 'POST' && isset($_POST['var1']) && isset($_POST['var2']) && isset($_POST['var3']) && isset($_POST['var4']) )
{ //do stuff
}[/PHP]
So can I add something like && $_submit_name == 'recruit' ???
Also, I know this is a php forum, but do you also know the javascript offhand:
[HTML]if ( document.myform .var1.value == "" && document.myform .var2.value == "" && document.myform .var3.value == "" && document.myform .var4.value == "" )[/HTML]
Well what I want is to have one form, but two submit buttons. Depending on which submit button is pressed, different code will run.
Here is a short version of my form:
[HTML]<form action="myform. php" method="POST">
<input name="var1" type="text" value="0" size="7" maxlength="6" />
<input name="var2" type="text" value="0" size="7" maxlength="6" />
<input name="var3" type="text" value="0" size="7" maxlength="6" />
<input name="var4" type="text" value="0" size="7" maxlength="6" />
<input name="recruit" type="submit" value="Recruit" />
<input name="disband" type="submit" value="Disband" />
</form>
[/HTML]
The php check:
[PHP]if ( $_SERVER['REQUEST_METHOD '] == 'POST' && isset($_POST['var1']) && isset($_POST['var2']) && isset($_POST['var3']) && isset($_POST['var4']) )
{ //do stuff
}[/PHP]
So can I add something like && $_submit_name == 'recruit' ???
Also, I know this is a php forum, but do you also know the javascript offhand:
[HTML]if ( document.myform .var1.value == "" && document.myform .var2.value == "" && document.myform .var3.value == "" && document.myform .var4.value == "" )[/HTML]
Comment