There is list box named category which displays the list of category from the database, what I want is I want the list of subcategories in list box from the database on selecting the Category list box.
My Code is here.
<?
include "config.php";
$cat = mysql_query("select id,title from jos_categories where section='com_vehiclemanager'");
?>
// Form 1
<form id="form1" name="form1" method="post" action="">
<p align="center">
<select name="category" id="category" tabindex="1" onChange="fillmodel();">
<option>Select Category</option>
<?
while($row=mysql_fetch_array($cat))
{ ?>
<option value="<? $row['id']; ?>" <? if($_REQUEST['category']==$row['id'])
{?> selected = "selected" <? } ?>> <? echo $row['title']; ?> </option>
<?
}
?>
</select>
</form> </p>
// Form 2
<script>
function reload(form)
{
var val=form1.category.options[form1.category.options.selectedIndex].value;
self.location='imagemove.php?cat=' + val ;
}
function fillmodel()
{
<?
if(isset($cat) and strlen($cat) > 0){
echo "document.form2.model.disabled = false;";
}
else{echo "document.form2.model.disabled = true;";}
?>
</script>
include "config.php";
$cat = mysql_query("select id,title from jos_categories where section='com_vehiclemanager'");
?>
// Form 1
<form id="form1" name="form1" method="post" action="">
<p align="center">
<select name="category" id="category" tabindex="1" onChange="fillmodel();">
<option>Select Category</option>
<?
while($row=mysql_fetch_array($cat))
{ ?>
<option value="<? $row['id']; ?>" <? if($_REQUEST['category']==$row['id'])
{?> selected = "selected" <? } ?>> <? echo $row['title']; ?> </option>
<?
}
?>
</select>
</form> </p>
// Form 2
<script>
function reload(form)
{
var val=form1.category.options[form1.category.options.selectedIndex].value;
self.location='imagemove.php?cat=' + val ;
}
function fillmodel()
{
<?
if(isset($cat) and strlen($cat) > 0){
echo "document.form2.model.disabled = false;";
}
else{echo "document.form2.model.disabled = true;";}
?>
</script>
Please help me
}
12/26/2009 - 00:02
include "config.php";
$cat = mysql_query("select id,title from jos_categories where section='com_vehiclemanager'");
?>
// Form 1
Select Category
<?
while($row=mysql_fetch_array($cat))
{ ?>
" <? if($_REQUEST['category']==$row['id'])
{?> selected = "selected" <? } ?>> <? echo $row['title']; ?>
<?
}
?>
// Form 2
<script>
function reload(form)
{
var val=form1.category.options[form1.category.options.selectedIndex].value;
self.location='imagemove.php?cat=' + val ;
}
function fillmodel()
{
<?
if(isset($cat) and strlen($cat) > 0){
echo "document.form2.model.disabled = false;";
}
else{echo "document.form2.model.disabled = true;";}
?>
</script>
Add Comment
[language] [/language]
Examples:
[javascript] [/javascript]
[actionscript] [/actionscript]
[csharp] [/csharp]
See here for supported languages.
Javascript must be enabled to submit anonymous comments - or you can login.