Steppio Posted May 21, 2007 Share Posted May 21, 2007 Hi, i have a small problem concerning dates in PHP. I wish to take 3 options from 3 seperate drop-down boxes, POST them to a seperate page, checkdate all 3 selections together and them convert them into ISO 8601 format so i can store them in my database. My code after the POST is: <?php require_once('main_fns.php'); session_start(); check_valid_user(); $month = $_POST['month']; $day = $_POST['day']; $year = $_POST['year']; checkdate($day, $month, $year); $gigvenue = $_POST['add_venue']; $gigtime = $_POST['time']; $gigprice = $_POST['price']; $gigaddress = $_POST['add_address']; $gigcomments = $_POST['add_comments']; try { //check forms filled in if (!filled_out($_POST)) { throw new Exception('You have not filled out the form correctly '. '- please go back and try again.'); } add_gigs($gigdate, $gigvenue, $gigaddress, $gigtime, $gigprice, $gigcomments); require('head.inc'); echo 'Your gig was succesfully added, thank you for your time. <br />'; echo '<a href="gigs.php?<?php echo strip_tags(SID); ?>">Go to the gigs page...</a>'; require('foot.inc'); } catch (Exception $e) { require('head.inc'); echo $e->getMessage(); require('foot.inc'); exit; } ?> Basically i'd just like to add the $day, $month and $year variables into 1 variable. Any ideas? Link to comment https://forums.phpfreaks.com/topic/52348-solved-turning-3-date-variables-into-1/ Share on other sites More sharing options...
AndyB Posted May 21, 2007 Share Posted May 21, 2007 $today = date("Y-m-d", mktime(0,0,0,$month,$day,$year)); // assumes variables are integers Link to comment https://forums.phpfreaks.com/topic/52348-solved-turning-3-date-variables-into-1/#findComment-258309 Share on other sites More sharing options...
Steppio Posted May 21, 2007 Author Share Posted May 21, 2007 Thanks alot i'll try that now Link to comment https://forums.phpfreaks.com/topic/52348-solved-turning-3-date-variables-into-1/#findComment-258319 Share on other sites More sharing options...
Steppio Posted May 21, 2007 Author Share Posted May 21, 2007 Thanks buddy, works a dream! Link to comment https://forums.phpfreaks.com/topic/52348-solved-turning-3-date-variables-into-1/#findComment-258326 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.