On Wednesday 15 January 2003 03:23, Mignon Hunter wrote: > Hello list, > > I submitted this problem earlier but got no response so I thought I'd > elaborate. > > The code below successfully displays all of the problems from the db. > Based on what is chosen here, needs to go into another table in the db > along with a customer tracking id. > > for($knt = 0;$row = mysql_fetch_row($res3); $knt++) > { > $cat_detail = $row[0]; > echo "<tr><td><input type=\"checkbox\" name=\"prob[]\" value = > \"$cat_detail\"></td> <td> $cat_detail </td>" > ."<td> High <input type=\"checkbox\" name=\"level[]\" > value=\"1\"></td>" > ."<td> Med <input type=\"checkbox\" name=\"level[]\" > value=\"2\"></td>" > ."<td> Low <input type=\"checkbox\" name=\"level[]\" > value=\"3\"></td>" > ."<td><center><input type=\"checkbox\" name=\"yes\"> Yes > </center></td></tr>"; > } > > When this page is submitted, I can successfully capture $prob[] - but I > am having no luck in pulling the corresponding $level[] (if one was > checked). So my form - once submitted - may look like: > > Problem one (no priority picked) > Problem two High priority > Problem three Low priority > > My $prob[] would be: My $level[] would be: > > $prob[0]: Problem one $level[0]: High > $prob[1]: Problem two $level[1]: Low > $prob[2]: Problem three > > So as you can see my second problem does not correctly correspond to the > correct priority. The first (or all) element(s) in the level array may > be null. The reason is that: 1) unchecked checkboxes do not make it into php 2) because you're not specifying an index for the array (level[]), php will create it for you automatically So instead of using just name="level[]" specify the level explicitly: name="level[0]", name="level[1]", etc NB you should do the same for prob[] as well. Having done that then in your example you should get something like: $prob[0]: Problem one $prob[1]: Problem two $level[1]: High $prob[2]: Problem three $level[2]: Low NB that $level[0] is undefined. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Harp not on that string. -- William Shakespeare, "Henry VI" */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php