Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,457
    Thanks
    15
    Thanked 0 Times in 0 Posts

    date - help debug

    I am using the following code to make select boxes with a date (and my date selected) I thought it was working but now the month is not showing up at all. Please help me debug.

    Here's the code

    PHP Code:
    <?php
    $min 
    explode('-'date('Y-m-d')); 
    $max explode('-'date('Y-m-d'mktime(000, ($min[1] + 3), $min[2], $min[0])));
    $dtremoveexplode('-'$datetoremove); 
    $year=$dtremove[0];
    $month=$dtremove[1];
    $day=$dtremove[2];
    ?>
    <tr><td><b>Date to Remove </b><font size=small>Day/Month/Year</font><br></td>
    <td>
     <select name="day" id="day"> 
    <?php 
    for($j 1$j <= 31$j++) 


     
    if(
    $j== $day){ ?> 
           <option selected value="<?php echo $j?>"><?php echo $j?></option> 
     <?php
     
    }else{
     
    ?>
      <option value="<?php echo $j?>"><?php echo $j?></option> 
    <?php
     


    ?> 
      </select> 
     <select name="month" id="month"> 
    <?php 
    for($i $min[1]; $i <= $max[1]; $i++) 


     if(
    $i== $month){ ?> 
          <option selected value="<?php echo $i?>"><?php echo date('F'mktime(000$i1$min[0])); ?></option> 
     <?php
     
    }else{
     
    ?>
      <option value="<?php echo $i?>"><?php echo date('F'mktime(000$i1$min[0])); ?></option> 
    <?php
     


     

    ?> 
      </select> 
     
      <select name="year" id="year"> 
        <option value="<?php echo $min[0]; ?>"><?php echo $min[0]; ?></option> 
    <?php if($max[0] != $min[0]){ ?> 
        <option selected value="<?php echo $max[0]; ?>"><?php echo $max[0]; ?></option> 
    <?php ?> 
      </select>

  • #2
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Ok if it is really debug you want then:
    Notice: line 5 - Undefined variable: datetoremove
    Notice: line 7 - Undefined offset: 1
    Notice: line 8 - Undefined offset: 2
    Side note: Undefined offset is just like a undefined variable but in an array eg. :
    PHP Code:
    $dtremove[1] = UNSET 

  • #3
    Senior Coder
    Join Date
    May 2004
    Posts
    1,457
    Thanks
    15
    Thanked 0 Times in 0 Posts
    $datetoremove is defined above the code.
    the year and day is working. It's just month that is not working.


  •  

    Posting Permissions

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