I have a table made up of time slots, when the user clicks maybe one or two and presses submit, i would like the date selected and the time slots chosen to be saved in to my sql.

I am working on the query but a little stuck in regards to the query, i have done the following:

$username = "root";
$password = "";
$hostname = "localhost";

 $dbhandle = mysql_connect($hostname, $username, $password) or die ("no         
 connection to database");


$start = mysql_real_escape_string($_POST['start']);
$end = mysql_real_escape_string($_POST['end']);
$booked = mysql_real_escape_string($_POST['booked']);

$selected = mysql_select_db("booking", $dbhandle);


i have set the table as follows

 <input data-val='08:30 - 08:45' class='fields' type='checkbox'   
 name="booked[]" />

Your input name and the name in your post do not match.

When debugging things like this, it may help to use var_dump(), particularly in your case


and see what you get.

i have amended my code and now does what i want, but now i have an error in the database, when data saved into the database is incorrect it shows:

i selected 17:45-18:00 but in the database it is shown as:

start end
00:00: 00:00:

Did you try the var_dump? What values are in $_POST["start"]?