0

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:

<?php
$username = "root";
$password = "";
$hostname = "localhost";


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


if(isset($_POST['Submit'])){

$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[]" />

Edited by Tom_11

2
Contributors
3
Replies
13
Views
2 Years
Discussion Span
Last Post by ryantroop
0

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

var_dump($_POST);

and see what you get.

0

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:

Edited by Tom_11

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.