SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic month name

    Hello All

    How do I get name of the month from 'January' to 'December' dynamically.

    Please help me.
    Barbara

  2. #2
    SitePoint Evangelist BJ Duncan's Avatar
    Join Date
    Jun 2007
    Location
    Bowen Mountain, NSW
    Posts
    490
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to place them into an array.

    PHP Code:
    <?php
    # Making the month array
    $months = array(=> "January""February""March""April""May""June""July""August""September""October""November""December");
    ?>
    If you use this form of array in a form then the values come out as digits.
    HTML Code:
    <select name="month"><option value="1">January</option>
    <option value="2">February</option>
    <option value="3">March</option>
    <option value="4">April</option>
    <option value="5">May</option>
    <option value="6">June</option>
    <option value="7">July</option>
    <option value="8">August</option>
    <option value="9">September</option>
    <option value="10">October</option>
    <option value="11">November</option>
    <option value="12">December</option>
    </select>
    There are many tutorials on PHP Arrays. HERE IS A GOOD PLACE TO START
    Regards,
    BJ Duncan


Bookmarks

Posting Permissions

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