问题描述:

I have did some code but now i want to add sub categories in my main category but now i want when admin click on any option the page will automatically refresh because below this i have a sub category option when it will refresh the page then my particular subcategories will appear i hope if you guys have any suggestion then please suggest me.

<select name="cat">

<option value='null'>Select your Desire</option>

<?php

include('includes/db.php');

$c_query="select * from categories";

$c_run=(mysql_query($c_query));

while($c_row=mysql_fetch_array($c_run)){

$c_id=$c_row['p_id'];

$c_title=$c_row['p_title'];

echo "<option value='$c_id'>$c_title</option>";

}

?>

</select>

网友答案:

Instead of submitting the page on change of first dropdown, use Ajax to get options for second dropdown list.

Read this tutorial: http://www.plus2net.com/php_tutorial/ajax_drop_down_list.php

相关阅读:
Top