I am pretty new in PHP and I have the following problem passing a data from a form to a .php file that have to handle it.
So this is the form into the rendered page:
<form method="post" action="common/remove-booking_pc.php" class="ajax-form">
<input id="id_booking" name="id_booking" value="5" type="hidden">
<a href="/PandaOk/templates/default/common/remove-booking_pc.php" type="submit">
<i class="fa fa-power-off"></i>
Conferma
</a>
</form>
It is what is shown looking into the browser code. As you can see it is passing a single data field, this:
<input id="id_booking" name="id_booking" value="5" type="hidden">
The passed value is 5.
So when I submit this form it is rendered by this file remove-booking_pc.php:
<?php
$id_booking = $_POST['id_booking'];
$result_remove_booking = $db->query("UPDATE pm_booking SET status= " . $id_booking);
?>
The problem is that the $id_booking is null and the $_POST is an empty array.
Why? What is wrong? What am I missing? How can I correctly pass this value?