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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.