How to insert values into a junction table?
If I guessed correct you are using PHP PDO, so what your are looking for is this function. http://us3.php.net/manual/en/pdo.lastinsertid.php. It will return the id off the last insert tuple into the database which you can save in a variable to be used in the insert for the junction table.

$stmt = $sqli-&gt;prepare("INSERT INTO book(book_original_name, book_turkish_name, book_publication_date, book_synopsis) VALUES (?,?,?,?)");
$stmt-&gt;bind_param("ssss", $_POST['book_original_name'], $_POST['book_tr_name'], $_POST['book_year'], $_POST['book_synopsis']);
$stmt-&gt;execute();
$book_id = $stmt-&gt;insert_id;
$stmt-&gt;close();

$stmt = $sqli-&gt;prepare("INSERT INTO metadata_images(metadata_image_value, type, size) VALUES (?,?,?)");
$stmt-&gt;bind_param("sss", $name, $_FILES['book_cover']['type'], $_FILES['book_cover']['size']);
$stmt-&gt;execute();
$cover_id = $stmt-&gt;insert_id;
$stmt-&gt;close();

$stmt = $sqli-&gt;prepare("INSERT INTO book_main_cover VALUES(?,?)");
$stmt-&gt;bind_param($book_id, $cover_id);
$stmt-&gt;execute();
$stmt-&gt;close();