Jump to content


Photo

Dynamic loading of list boxes using onChane


  • Please log in to reply
No replies to this topic

#1 shan_cool

shan_cool
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts
  • LocationChennai,India

Posted 06 March 2006 - 04:22 AM

Hi All,

I have 3 list boxes,The first list boxes contains the project names and the second list box contains module names and the third list box contains sub module names.

All the project names,module names and its sub modules have there own separate master tables.

what is expected is, if i click the project name only its respective module names shld be displayed and if i click the module name only its sub modules shld be displayed.

i am able to do for 2 list boxes tht is if i select the project all its sub modules are displayed i want the same to be happend for sub modules too?

i am using php with mysql


the code which i used is as follows:

Javascript

function window_onload() {
var qs=location.search.substring(1,location.search.length);
var pair = qs.split('=');
temp = unescape(pair[1]).split('+');
document.form1.prd_name.value=temp;
}
function Product_onblur()
{
var my_prd= "";
var index1=document.form1.prd_name.selectedIndex
my_prd=document.form1.prd_name.options[index1].value
window.location.href = unescape("log_defect.php"+"?prod_name="+my_prd);
}


php code:

<select style="border-style:none; FONT-SIZE: 10pt; WIDTH: 137px; COLOR: #222222; " name="prd_name" style="font-size: 10pt" tabindex="2" onChange="return Product_onblur()">
<?php
$query=mysql_query("SELECT prod_name name FROM dt_product order by prod_name ASC",$connection )or die ("cant do it");
while ($result=mysql_fetch_array($query))
{
echo '<option value="' . $result['name'] . '">' . $result['name'] . '</option>';
}
?>

</select>


can anybody help me,

Thanks in advance
shan





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users