How to get a value via GET and others via POST at the same time?

1

I have a link that passes a value via GET to a page:

pagina.php?id=1

Within pagina.php I have a form that will do a POST for itself, but I get the value of id with $_GET['id'] and form with $_POST when submitting.

The problem is that while submitting the form I also need the value of id together, but since it is received via GET , adding a input hidden with name="id" to the form would not work because id would not be received via GET .

How could I get around this by sending id along with the form and only id would have to be received via GET ?

    
asked by anonymous 04.08.2018 / 00:02

1 answer

3

You can try this:

<form action="minhaacao.php?id=<?php echo $_GET['id']?>" method="post">
    <!-- demais inputs -->
</form>
    
04.08.2018 / 00:19