Jump to content

[SOLVED] Comparing Times


dylandcor

Recommended Posts

I use this in a registration form so that the form remembers the value if there is an error.  When it passes a certain time, $closed_oakdale, I would like one of the options to disappear.  The form values don't seem to switch no matter what time I put.  It always seems that $now is always less than $closed_oakdale.  I can't seem to figure out what is wrong, but I'm sure it's simple.  Sorry for my lack of knowledge.  Any help would be greatly appreciated!

 

        <?php

$now= strtotime('now');
$closed_oakdale= strtotime('July 06, 2009 23:02:15');



if($now < $closed_oakdale)
{
$arr = array('Select a Campus', 'Oakdale', 'Bridgeville');
}
if($now > $closed_oakdale){
$arr = array('Select a Campus', 'Bridgeville');
}

    for($i2 = 0; $i2 < count($arr); $i2++)
  {
if(isset($campus)){
$selected = ($arr[$i2] == $campus) ? 'selected="selected"' : '';
}else{
$selected = ($arr[$i2] == $arr[0]) ? 'selected="selected"' : '';
  }
  echo "<option value=\"{$arr[$i2]}\" {$selected}>{$arr[$i2]}</option>\n";
}
   ?>

Link to comment
https://forums.phpfreaks.com/topic/165018-solved-comparing-times/
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.