DeanWhitehouse Posted May 24, 2008 Share Posted May 24, 2008 I have this code for a dynamic dropdown list. These are my lists. i need the second one to be decided from the first option, but without refreshing the page. The first one shows main catergory's and the second sub-catergory's. Can anyone help. <tr><td><span class="style7">Gallery:</td><td> <?php $query = "SELECT catergory FROM `image_catergory`"; $result = mysql_query($query) or die("Error:" . mysql_error()); ?> <select name='folder'> <?php if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { echo "<option>".$row['catergory']."</option>"; } } ?> </select> </span></td> <?php if(mysql_num_rows($result) < 1) { echo "<tr><td><a href='".$_SERVER['HTTP_HOST']."/add_catagories.php'>Add Catergory</a></td></tr>"; } ?> <tr><td><span class="style7">Sub-Gallery:</td><td> <?php $quey = "SELECT sub_cat FROM `sub_cat`"; $reult = mysql_query($quey) or die("Error:" . mysql_error()); ?> <select name='subfolder'> <?php if (mysql_num_rows($reult) > 0) { while ($ow = mysql_fetch_assoc($reult)) { echo "<option>".$ow['sub_cat']."</option>"; } } ?> </select> </span></td> </tr><tr><td><input type="submit" name="upload" value="Upload"></td></tr></td></tr></table></form> </form> <?php if(mysql_num_rows($result) < 1) { echo "<tr><td><a href='".$_SERVER['HTTP_HOST']."/add_catagories.php'>Add Catergory</a></td></tr>"; } } ?> Link to comment https://forums.phpfreaks.com/topic/107019-ajax-code-i-think-for-dynamic-dropdown/ Share on other sites More sharing options...
Barand Posted May 24, 2008 Share Posted May 24, 2008 AJAX sample code in my sig Link to comment https://forums.phpfreaks.com/topic/107019-ajax-code-i-think-for-dynamic-dropdown/#findComment-548632 Share on other sites More sharing options...
haku Posted May 24, 2008 Share Posted May 24, 2008 This is not a php question it's an ajax question, and there is an ajax section of this forum. Link to comment https://forums.phpfreaks.com/topic/107019-ajax-code-i-think-for-dynamic-dropdown/#findComment-548681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.