Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Member ThePhoenix2006's Avatar
    Join Date
    Mar 2005
    Location
    Michigan
    Posts
    88
    Member #
    9431
    Hey there,

    I am trying to make three drop downs one for the day month and year.

    I cannot for some reason get it to work. Heres my code.

    What am I doing wrong here?

    PHP Code:
                          <?php 

    //create variables for the date 
    //$date = mktime(0,0,0,) 

    //two digit month ex: 01 for January 
    $month Date("m",mktime(000date("m"), date("d")+7date("y"))); 
    $selected[$month] = 'selected'

    //two digit day ex: 03 for the 3rd day in a month 
    $day Date("d",mktime(000date("m"), date("d")+7date("y"))); 

    //two digit year ex: 04 for 2004 
    $year Date("Y",mktime(000date("m"), date("d")+7date("y"))); 
    ?> 
    <select name=completeMonth> 
    <option value=Jan <?=$selected['01']?>January</option> 
    <option value=Feb <?=$selected['02']?>February</option> 
    <option value=Mar <?=$selected['03']?>March</option> 
    <option value=Apr <?=$selected['04']?>April</option> 
    <option value=May <?=$selected['05']?>May</option> 
    <option value=Jun <?=$selected['06']?>June</option> 
    <option value=Jul <?=$selected['07']?>July</option> 
    <option value=Aug <?=$selected['08']?>August</option> 
    <option value=Sep <?=$selected['09']?>September</option> 
    <option value=Oct <?=$selected['10']?>October</option> 
    <option value=Nov <?=$selected['11']?>November</option> 
    <option value=Dec <?=$selected['12']?>December</option> 
    </select> 
    <input size=2 value= <?php echo "$day?> <name="completeDay"> 
    , <input size=4 value= <?php echo "$year?> <name="completeYear">
    "Make sure the juice is worth the squeeze" ~The Girl Next Door

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Try something like this:
    PHP Code:
    <?php
    // Array of month names
    $months = ['Jan''Feb''Mar''Apr''Jun''Jul''Aug''Sep''Oct''Nov''Dec'];

    //create variables for the date
    $day Date("d",mktime(000date("m"), date("d")+7date("y")));
    $month Date("m",mktime(000date("m"), date("d")+7date("y")));
    $year Date("Y",mktime(000date("m"), date("d")+7date("y")));

    // Month selection
    echo "<select name=\"completeMonth\">";
    for (
    $i=1$i<=12$i++)
      echo 
    "<option value=\"$i\"" . ($i == $month) ? " selected" ""  ">" $months[$i-1] . "</option>";
    echo 
    "</select>";

    // Day selection
    echo "<select name=\"day\">";
    for (
    $i=1$i<=31$i++)
      echo 
    "<option value=\"$i\"" . ($i == $year) ? " selected" ""  ">$i</option>";
    echo 
    "</select>";

    ?>
    ...and so on...


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:40 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com