hello guys i need help on inserting my html type-time into my database..this is my form html.
<tr>
<td><font color="black">Time:</td>
<td colspan = "2"><input type = "time" name = "time_hr"></td>
</tr>
this is the post method
@$time_hr=$_POST['time_hr'];
this is my query
$query = " INSERT INTO receipt VALUES ('','$cust_data','$cust_address','$cust_id',
'$sets','$time_hr',$cold','$hot','$price','$q','$sum','$deposit','$amount','$booking_date' ,'PENDING')";
i was wondering how to insert it into my database. my xampp structure for time is varchar.
please and thank you and sorry for any inconvenience.
You have syntax error in your query. You are missing one single quote near $cold
variable. Try following query.
$query = " INSERT INTO receipt VALUES ('', '$cust_data', '$cust_address', '$cust_id',
'$sets', '$time_hr', '$cold', '$hot', '$price', '$q', '$sum', '$deposit', '$amount',
'$booking_date', 'PENDING')";
Also try echo mysql_error()
to know if any other error is there in the query.
Your Insert Query is wrong. Please follow the below example
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)
And take varchar datatype into your database value 60
This should be
@$time_hr=$_POST['time_hr'];
Change to this
$time_hr=$_POST['time_hr'];
then your query works
INSERT INTO receipt
VALUES('','$cust_data','$cust_address','$cust_id','$sets','$time_hr',
$cold','$hot','$price','$q','$sum','$deposit','$amount','$booking_date' ,'PENDING')";