shadiadiph Posted December 19, 2008 Share Posted December 19, 2008 Hi I have the following php form the second selection item has to relate to the first selection item but i am totally lost here here is the code i have at the moment it is displaying items in the second selection but they are not related to the first item selected. <td class="right"> <? $sql = "SELECT * FROM tblcatdetails ORDER BY category ASC"; $result = mysql_query($sql); echo '<select name="category">'; while ($row = mysql_fetch_assoc($result)) { $catid = $row["intCatID"]; $category = $row["category"]; echo '<option value="'.$catid.'">'.$category.'</option>'; } echo '</select>'; ?> </td></tr> <tr><td class="left">Sub Category:</td> <td class="right"> <? $sql = "SELECT * FROM tblsubcatdetails where intCatID='$catid' ORDER BY subcategory ASC"; $result = mysql_query($sql); echo '<select name="subcategory">'; while ($row = mysql_fetch_assoc($result)) { $subcatid = $row["intSubCatID"]; $subcategory = $row["subcategory"]; echo '<option value="'.$subcatid.'">'.$subcategory.'</option>'; } echo '</select>'; ?> </td></tr> Quote Link to comment https://forums.phpfreaks.com/topic/137726-solved-mm-select-problem-with-php-quite-tricky/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.