0
I’m trying to create a button that returns to the form to fix it, thus keeping all the content typed in the HTML for the user to correct the wrong information, but sending a variable PHP so I can do the UPDATE in the Mysql, without entering a new record.
I thought I’d send a ID
:
<!DOCTYPE html>
<html>
<body>
<form>
<input type="hidden" name="ID" value="<?php echo $ID; ?>"/>
<input type="submit" formaction="cancela_cadastro.php"
value="Cancelar pedido">
<input type="submit" formaction="../index.php" value="novo pedido">
<input type="button" value="Corrigir"
onClick="(history.go(-1), '<?php echo $ID; ?>')"/>
</form>
but without success. The ID
is inserted into "cancela_cadastro.php?ID=XX"
and in the "../index.php?ID=XX"
- The latter unintentionally, but it makes no difference.
I wonder if there is a way to send this variable on history.go(-1)
, or if there is a way to send this variable back to the completed form.
PS. The history.go(-1)
stopped working when I assigned this variable PHP.
if Voce wants it to return because it does not validate the form ?
– Victor
Thank you for the answer, I think I had an idea with her. Instead of returning to the submission, I show the fields filled in and ask the user to correct or actually submit the form... Of course! Thank you very much!
– user1160927
Just to complement, it is not possible to pass other parameters in the method
go()
ofwindow.history
. He only accepts oneint
or astring
containing a URL.– user98628
Thank you for the answers. I think I will have an "intermediary" form, between the sending and the confirmation form.
– user1160927