Thread: loop question

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    3
    Rep Power
    0
    I'd like to take the input from a form, an array, and loop through it and do something. The array is from a series od check boxes, so the exact number will not be known because it will vary depending on how many get checked.

    Like: "While ($check[]) { do this }"

    What is the correct syntax?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    15
    This would loop through them and print the value, just use the logiuc for your needs.

    while (list ($key, $val) = each ($checkboxesname)) {
    print $val ."<br>";
    }

Similar Threads

  1. Function question about a while loop
    By rkelley in forum PHP Development
    Replies: 3
    Last Post: January 26th, 2004, 12:56 AM
  2. How to clear a string in a loop??
    By Gecko22 in forum ASP Programming
    Replies: 2
    Last Post: January 23rd, 2004, 01:35 PM
  3. issues with the while loop
    By lobo78 in forum PHP Development
    Replies: 2
    Last Post: January 1st, 2004, 12:01 PM
  4. PHP data retrieval question with MySQL
    By gursharn in forum PHP Development
    Replies: 7
    Last Post: December 31st, 2003, 09:43 AM
  5. A mixed foreach loop
    By Datamike in forum Dev Shed Lounge
    Replies: 11
    Last Post: December 17th, 2003, 08:40 PM

IMN logo majestic logo threadwatch logo seochat tools logo