Jump to content

Trying to merge Date and Time Fields


bravo14

Recommended Posts

Hi

 

I am trying to merge to fields to make a date and time.  The date field is calculated to be 4 days from today and the time is selected from a select menu using the following code

 

<select name="end_time">
  <option value="12:00:00">12:00 Noon</option>
  <option value="17:00:00">5:00pm</option>
</select>

 

Using the following php script

 

$end_time=strtotime("H:i",$_POST['end_time']);  //Line 35
$date=date("Y-m-d");
$end_date=strtotime($date ."+4 days" );
$end_date_time=$end_date.$end_time;

$add_vehicle_sql=mysql_query("INSERT INTO `tbl_auction_lot`(`cust_id`,`reserve`,`make`,`model`,`spec`,`fuel`,`doors`,`mot_date`,`fns`,`fos`,`rns`,`ros`,`condition`,`reg_no`,`service_history`,`sale_type`,`status`,`keepers`,`gearbox`,`emissions`,`colour`,`date_first_reg`,`date_manufacture`,`bhp`,`engine_size`,`end_date`,`current_price`)
VALUES ('$seller_id','$reserve','$make','$model','$body_style','$fuel_type','$no_of_doors','$mot','$fns','$fos','$rns','$ros','$vehicle_condition','$vrm','$service_history','auction','$status','$prev_keepers','$gearbox','$emissions','$colour',$date_reg','$date_man','$bhp','$engine_size', '$end_date_time','$reserve')") or die(mysql_error());

 

I am getting the following error message

 

Notice: A non well formed numeric value encountered in /home/sites/trade-bidz.co.uk/public_html/add-vehicle.php on line 35

 

What have I done wrong?

Link to comment
https://forums.phpfreaks.com/topic/244585-trying-to-merge-date-and-time-fields/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.