0
Basically what I need is to put a 'back' button inside my form. It has to be inside for aesthetic reasons, the back button would be inline with the send button.
I made a short code:
<form action="php/***.php" method="post">
<p>DIGITE SEU NOME:
<input type="text" placeholder="nome" name="nome" id="nome"><p>
<input type="submit">
<a onClick="window.location='home.php';">
<button style="margin-left: 10%" class="bt2" >Voltar</button>
</a>
</form>
But when I click the 'back' button it directs to the action page in the form, not to the onclick home page.
I managed to make it work on one page, but if I copy exactly the same code, it doesn’t work on others. Very strange.
Instead of using
onClick
, wouldn’t it be better to usehref
?<a href="home.php">Voltar</a>
– Luiz Felipe
using href there the code will not leave even, because the action of the form overlaps. As I had said, on one page I was able to make js override html. But when I played the code it no longer worked =/
– ARodrigues
Can’t take out the "a" and put onClick right on the button?
– hugocsl