www.webdeveloper.com
Results 1 to 2 of 2

Thread: PHP Date - What am I doing wrong?

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Location
    Seattle, WA
    Posts
    265

    Exclamation PHP Date - What am I doing wrong?

    Ok, so here's what I have... any idea where I'm going wrong? Because it's not working.

    PHP Code:
            <td><select name="date_<?php echo($eli); ?>"><?php
            $lastSaturday 
    strtotime('Saturday');
            
    $lasttime strtotime('-30 days'$lastSaturday);
            for(
    $ci=0;$ci<90;$ci++){
                
    $oldTime=$lastTime;
                if((
    $ci+1)==1){
                    
    $daysAhead='+'.($ci+1).' day';
                }else{
                    
    $daysAhead='+'.($ci+1).' days';
                }
                
    $lastTime=strtotime($daysAhead,$oldTime);
                
    ?>
                <option value="<?php echo(date('m-d-Y',$lasttime)); ?>"><?php echo(date('m/d/y',$lasttime)); ?></option><?php
            
    ?></select></td>
    It just gives me this for every single line:

    HTML Code:
    <option value="03-29-2012">03/29/12</option>
    I'm going cross-eyed from all the coding I've been doing lately so I can't spot my mistake(s)... Any help would be greatly appreciated.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,322
    I think it's a letter case issue in your $lastTime/$lasttime variables.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles