month day year drop-down update

Discussion in 'PHP' started by abs0lut01, Jul 20, 2008.

  1. #1
    In a registration form of mine the user selects the month, day and the year of their birthday with a drop-down menu. In the 'Update' form I would like their birthday to automatically display its selection.

    For example if my profile displays "jul 20 1984" my update form should be already display "jul 20 1984" in the the 3 select menu, but I keep getting 'None Selected'?

    Any help is greatly appreciated!
     
    abs0lut01, Jul 20, 2008 IP
  2. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #2
    
    <select name="bday_dd">
      <?php
      $bday_dd='23';//lets say so for example
      for($i=1; $i<32; $i++)
      {
        if($i==$bday_dd){echo '<option selected="selected">'.$i.'</option>';}
        else{echo '<option>$i</option>';}
      }
      ?>
    </select>
    
    PHP:
    On similar lines for month and year.
     
    rohan_shenoy, Jul 20, 2008 IP
  3. abs0lut01

    abs0lut01 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks, do I need to concat??
     
    abs0lut01, Jul 20, 2008 IP
  4. abs0lut01

    abs0lut01 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thanks, I already solved it.
     
    abs0lut01, Jul 26, 2008 IP