I have the following form
<form method='post' name='checkbox_form' id='checkbox_form' onsubmit='return validate()' action=''>
..............
..............
<input name='salvar' type='submit' value='Salvar'>
<input name='gravar' type='submit' value='Gravar'>
</form>
and in PHP, depending on the clicked button, the $pasta
variable takes its due value correctly.
if (isset($_POST["gravar"])||isset($_POST["gravar2"])){
$pasta="favoritas/";
}else{
$pasta="usuario/";
}
In addition there are two buttons that will, in a certain situation, appear within a modal
<div style=\"display:none\">
<div id=\"ajax2\" class=\"ajax2\">
<input name='salvar2' type='button' id='salvar' value='Salvar'>
<input name='gravar2' type='button' id='gravar' value='Gravar'>
</div>
</div>
To submit the form with the modal buttons I used the following script:
$("#salvar").click(function() {
$("#checkbox_form").submit();
});
$("#gravar").click(function() {
$("#checkbox_form").submit();
});
The problem: Whatever the button clicked on modal, the $pasta
variable takes the value usuario/
of the else
condition of PHP, ie, isset
p>
The question : How can I do the conditional execution in PHP correctly by clicking the modal buttons?