1
<form method="post" id="formulario_contato" onsubmit="validaForm(); return false; " class="form" action="?go=enviar">
<table id="login_table">
<div id="all">
<div id="login-box">
<p class="nome">
<input type="text" name="nome" id="nome" class="form-control" placeholder="Nome do paciente" />
</p>
<p class="idade">
<input type="text" name="idade" id="idade" class="form-control" placeholder="Idade do paciente" />
</p>
<p class="cpf">
<input type="text" name="cpf" id="cpf" class="form-control" placeholder="CPF do paciente" />
</p>
<!-- Botao Enviar -->
<p>
<center><input type="submit" value="Enviar" class="btn btn-info" href="sala_medico.php"/></center>
</p>
</div>
</div>
</table>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
if(@$_GET['go']=='enviar'){
}
I’m registering people who can choose to answer a questionnaire or not. This way, I need two "register" buttons for this same form, one for each action. Should it be impossible to do so, any other solution is welcome.
When you speak 'two actions' you refer to the attribute
action
form? You wanted two buttonssubmit
and if you click on a send to aaction
and if you click the other send to the otheraction
?– Leandro
Yes that’s right. I put on the page the script you sent and the form. But in the if to call the action I put what ?
– Guilherme Vian
It’s the way it is, you’ll just change the fields in the script addressAction1 and addressAction2 to specify the addresses of
actions
that you want for every occasion, ie theaction
in case the button clicked is 1 (inside theif
) and theaction
in case the button clicked is 2 (inside theelse
).– Leandro
I say this if here: <?php if(@$_GET['go']='send'){ } How I place to run a php function depending on the button you press. I didn’t understand how I run the action using php
– Guilherme Vian
That one
if
ofphp
you will no longer need it, you will only need the script anyway, the script will already take care of detecting the clicked button and direct the data to the respectiveaction
.– Leandro
Yes, but I wanted to use php inside the actions and not javascript. I’ve done the functions of the actions in php and it’s quite something :/
– Guilherme Vian
Then you should have made explicit in the question you wanted only in PHP and removed the javascript and jQuery tags, because, the way you put it, it is as if it served both in PHP, as in javascript/jquery.
– Leandro