I'm trying to create a button that returns the form to correct it, thus keeping all content typed in HTML for the user to correct the wrong information, however sending a PHP variable so I can do the UPDATE in MySQL without inserting a new one.
I thought about sending 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 in "cancela_cadastro.php?ID=XX"
and "../index.php?ID=XX"
- the latter unintentionally, but it makes no difference.
I would like to know if there is a way to send this variable in history.go(-1)
, or if there is a way to send this variable on return to the completed form.
PS . The history.go(-1)
stopped working when I assigned this PHP variable.