hi
thanks i tried that but it still doesnt work!
i didnt have it as a hidden field so i put that in but it still doesnt seem to recognise it
i wastn sure where the hidden field should go so i put it in a couple of places. hope u can say where the rite place would be.
the code for my search results is this and that is where the customer can select the accomm they want:
$self = $_SERVER['PHP_SELF'];
$id = $_POST["accommID"];
$type = $_POST["select_type"];
$sleeps = $_POST["select_sleeps"];
$board = $_POST["select_board"];
$description = $_POST["description"];
$pets_allowed = $_POST["select_pets_allowed"];
//$query = "SELECT type, sleeps, board, description, pets_allowed FROM accommodation WHERE type = '$type' AND sleeps = '$sleeps' AND board = '$board' AND description= '$description' AND pets_allowed = '$pets_allowed'";
$query = "SELECT type, sleeps, board, description, pets_allowed FROM accommodation WHERE type='$type' && sleeps = '$sleeps' && board='$board' && pets_allowed ='$pets_allowed'";
$result = mysql_query ($query) or die(mysql_error());
$num = mysql_num_rows($result);
if ($num > 0){
echo "<p>There is currently $num accommodation. </p>\n";
echo '<FORM METHOD="POST" ACTION="add_book.php">';
echo '<table align = "center" border = "1" cellspacing = "0" cellpadding = "5">
<tr>
<td align="left"><b>Type</b></td>
<td align="left"><b>Sleeps</b></td>
<td align="left"><b>Board</b></td>
<td align="left"><b>Description</b></td>
<td align="left"><b>Pets Allowed</b></td>
<input type = "hidden" name = "accommID" value = "'. $id . '" />
</tr>
';
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
echo '
<tr>
<td align="left">'. $row['type']. '</td>
<td align="left">'. $row['sleeps']. '</td>
<td align="left">'. $row['board']. '</td>
<td align="left">'. $row['description']. '</td>
<td align="left">'. $row['pets_allowed']. '</td>
<td align=center><input type=radio name=accommID value="'.$row['accommID'].'"></td>
</tr>
';
}
echo '</table>';
mysql_free_result($result);
} else {
echo '<p class = "error">There are currently no types of accommodation for the choices entered.</p>';
}
echo '<center> <input type="submit" value="Continue Booking"></center>';
echo '<input type = "hidden" name = "accommID" value = "'. $id . '" />';
echo '</FORM>';
mysql_close();
and then the booking code is:
$id = $_POST ["accommID"];
$book_start = $_POST ["booking_start_date"];
$book_end = $_POST ["booking_end_date"];
$query = "INSERT INTO booking (booking_start_date, booking_end_date, accommID) VALUES ('$book_start','$book_end','$id')";
//$query = "INSERT INTO booking (booking_start_date, booking_end_date) VALUES ('$book_start','$book_end')";
mysql_query($query, $connection) or die (mysql_error());