SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot The Big Show's Avatar
    Join Date
    Nov 2002
    Location
    USA
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face Basic Erray Loop

    I have studied PHP for awhile, but still have no clue when it comes to arrays.

    I was wondering how I can make an array loop that creates a drop-down menu of the numbers 1 through 31, where each of the numbers is listed as an individual option.

  2. #2
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The actual answer to your question doesn't involve an array, though you may use one when you submit the form:

    PHP Code:
    echo "<select name='myselect'>";
    for (
    $i 0$i 32$i++) {
       echo 
    "<option value='$i'>$i</option>";
    }
    echo 
    "</select>"
    My name is Steve, and I'm a super-villian.

  3. #3
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    might want to let $i start as 1...
    - website

  4. #4
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by website
    might want to let $i start as 1...
    I'm going to go down in history for mistypes!

    I guess thats what you get for hanging in the PHP forums, while @ work on the phone -- Thanks
    My name is Steve, and I'm a super-villian.

  5. #5
    SitePoint Enthusiast
    Join Date
    Dec 2002
    Location
    United States
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    He was just thinking of Javascript, right.

    -J


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
  •