CodeMama Posted August 4, 2009 Share Posted August 4, 2009 I need to figure out where the strtotime() goes to parse the date back to a date here is my code ..this is for a search function:: if (!empty($_POST['bmonth'])) { $bmonth = $_POST['bmonth']; $_SESSION['bmonth'] = $bmonth; $formEmpty = FALSE; $bmonth = TRUE; } else { $bmonth = ''; unset($_SESSION['bmonth']); $bmonth = FALSE; } if (!empty($_POST['bday'])) { $bday = $_POST['bday']; $_SESSION['bday'] = $bday; $formEmpty = FALSE; $bday = TRUE; } else { $bday = ''; unset($_SESSION['bday']); $bday = FALSE; } if (!empty($_POST['byear'])) { $byear = $_POST['byear']; $_SESSION['byear'] = $byear; $formEmpty = FALSE; $byear = TRUE; } else { $byear = ''; unset($_SESSION['byear']); $byear = FALSE; } $bdate = date("$bmonth/$bday/$byear"); if($formEmpty) { // No values were sent through $_POST, so form was empty. Reset $SESSION and redirect back to restaurants.php $_SESSION['results'] = NULL; Link to comment https://forums.phpfreaks.com/topic/168844-help-with-dates-and-placement-of-the-strtotime/ Share on other sites More sharing options...
darkfreaks Posted August 4, 2009 Share Posted August 4, 2009 what about something like off the manual <?php $str = 'Not Good'; // previous to PHP 5.1.0 you would compare with -1, instead of false if (($timestamp = strtotime($str)) === false) { echo "The string ($str) is bogus"; } else { echo "$str == " . date('l dS \o\f F Y h:i:s A', $timestamp); } ?> Link to comment https://forums.phpfreaks.com/topic/168844-help-with-dates-and-placement-of-the-strtotime/#findComment-890843 Share on other sites More sharing options...
CodeMama Posted August 4, 2009 Author Share Posted August 4, 2009 I have the date part working, but now if I search with no date inputted it returns nothing ..so now I can't just search by name...damnit. Link to comment https://forums.phpfreaks.com/topic/168844-help-with-dates-and-placement-of-the-strtotime/#findComment-890872 Share on other sites More sharing options...
darkfreaks Posted August 4, 2009 Share Posted August 4, 2009 can i see your current code i may be able to fin out why it returns nothing if no date is inputted Link to comment https://forums.phpfreaks.com/topic/168844-help-with-dates-and-placement-of-the-strtotime/#findComment-890874 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.