Web Analytics Made Easy -
StatCounter problem populating select box via php - CodingForum

Announcement

Collapse
No announcement yet.

problem populating select box via php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem populating select box via php

    Hi, I am having a problem with the following code:-
    PHP Code:
    $skills_query "SELECT skill_id, skill_name FROM skills";
       
    $skills_result mysql_query($skills_query);
       
    $num_rows_skills mysql_num_rows($skills_result); 
       print  
    $num_rows_skills;
       
       print 
    "<tr><td> Skills </td><td><select name='skillID[]' size='5' multiple";
       while (
    $skills=mysql_fetch_array($skills_result)){ 
           
    $skill=$skills["skill_name"];      
           print 
    "<option value='$skill'>";
           print 
    $skill;
           print 
    "</option>";
       }
       print 
    "</select></td></tr>"
    It is meant to populate a select box in a form with whatever is returned from the query. For some reason it does it, but always misses out the first entry from the database. It does retrieve all values as i can print them all, but as soon as I want them in a select box the first value is missed out. Anybody any ideas?

    Im not sure of the source of this problem so i apologise if it isnt classed as a php problem :-)

  • #2
    sorry, my fault - ive just had another look at it and realised that i have missed a > from the select ...

    Sorry for being a dumbass!!

    Comment


    • #3
      Lol, we all make those simple mistakes that mess up your code

      Comment

      Working...
      X