使用php(phpMyAdmin)从网站将外键插入表中

So, I have 3 tables in my database (phpMyAdmin) bikes, book and users. I have made bike_id and user_id a foreign key in the book table. Now I want these 2 to get inserted into the book table from the web page. I've got 3 php files which are book1.php, book2.php and book3.php. In book1, you can select a bike which you want to book which results in showing that particular bike in new page. In book2, you select the date when you want to book and when you go to book3, the user_id and bike_id should be automatically inserted into the book table? But I only get ERROR when I press book in book2 page. Can someone help me plz.. Below is the php codes for 3 php files.

book1.php:

 <?php
require 'connect.php';

$select_posts = "select * from bikes ";

$run_posts = mysql_query($select_posts);
?>
<table cellpadding="2" cellspacing="2" border="2">
    <tr>

        <th>Name</th>
        <th>Image</th>
        <th>Available</th>
        <th>Select Bike</th>
    </tr>
    <?php while($row=mysql_fetch_array($run_posts)){ ?>
    <tr>

        <td><?php echo $row[bike_name]; ?></td>
        <?php echo "<td>";?> <img src="<?php echo $row[bike_image]; ?>" height="250" width="300"> <?php echo "</td>";?>
        <td><?php echo $row[avail]; ?></td>
        <td><a href="book2.php?id=<?php echo $row[bike_id];?>">Select</td>
    </tr>
    <?php } ?>

book2.php:

<?php 
session_start();
?>

<?php
require 'connect.php';

if(isset($_GET['id'])){

$took_id = $_GET['id'];

$select_query = "select * from bikes where bike_id='$took_id'";

$run_query = mysql_query($select_query);
?>
<table cellpadding="2" cellspacing="2" border="2">
    <tr>

        <th>Name</th>
        <th>Image</th>
        <th>Available</th>
        <th></th>
        <th>Select Date</th>
        <th>Book</th>

    </tr>
    <?php while($row=mysql_fetch_array($run_query)){ ?>
    <tr>
        <form action="book3.php" method="POST">
        <td><?php echo $row[bike_name]; ?></td>
        <?php echo "<td>";?> <img src="<?php echo $row[bike_image]; ?>" height="250" width="300"> <?php echo "</td>";?>
        <td><?php echo $row[avail]; ?></td>
        <td><?php echo $took_id; ?></td>
        <td>Select Date: <input type="text" id="datepicker" name="datepicker"></td>
        <td><input type="submit" name="Submit" value="Book"></td>
    </tr>
    <?php }} ?>
</table>

book3.php:

<?php
session_start();
?>
<?php
require 'connect.php';

// Get values from form 
$datepicker = $_POST['datepicker'];


$sql="INSERT INTO $tbl_name(datepicker)VALUES('$datepicker')";
$sql="INSERT INTO $tbl_name(user_id)VALUES(select user_id from users)";
$sql="INSERT INTO $tbl_name(bike_id)VALUES(select bike_id from bikes)";
$result=mysql_query($sql);

// if successfully insert data into database, displays message "Successful". 
if($result){
echo "Successful";
echo "<BR>";
}

else {
echo "ERROR";
}

?>