Web Hosting Talk







View Full Version : Combine Date Variables


avenue
07-25-2005, 10:34 AM
I have a simple form passing the date selected from drop downs. In my database the date format is YYYY-MM-DD. I have set the posted variables to $year, $month, and $date. What is the best way to combine these variables to submit correctly to the database? Thanks in advance :-)

avenue
07-25-2005, 10:41 AM
Got it..just needed quotes around the variables..

$eventDate = "$year-$month-$day";

tree-host
07-25-2005, 12:35 PM
just so you know, there are a few ways of doing it... i belive

$eventDate = "$year-$month-$day";
$eventDate = <<<EOT
$year-$month-$day
EOT;
$eventDate = $year."-".$month."-".$day;

Wouyld all do it, a lto depends on your 'style' or coding

avenue
07-25-2005, 12:46 PM
thanks for the tips