I have a table (venue) that produces a list of venues from from mysql db. I would like a that can select the venue name and insert it into another table: booking. I have a hidden input field that contains the venue name and a button for booking.
Here is my form:
<td><form action="bookvenues.php" method="post">
<?php echo "<input type='text' name='booking' value='".$venue['venuename']."' hidden/><button type='submit' class='btn btn-default'>Book this Venue</button>"?>
</form></td>;
Here is my PHP script:
<?php
mysql_connect("host","user","password") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
?>
<?php
$venuename = $_POST['booking'];
$result= "INSERT INTO booking (venuename) VALUES ('".$_POST['venuename']."')";
$add_venue = mysql_query($result);
echo "Venue Booked!";
?>
When I click the book button it echos venue booked and when I check my db a new row has been added but the venuename is empty. Any suggestions?
Thanks :)