hi all,
iam just a begineer in java script,and i tried my program that load data from a database in combo box,my table is managelinks that contain 2 fields title and url ,the title column is loaded in combo box and i tried when the user changes the value of this combo box i select from database the crossponding url and open it ,but it doesnot work well,
this is the code
<code>
<select onchange="address(this)" name="select" id="select">'
<script>
function address(obj)
{
var dropdownIndex = document.getElementById('select').selectedIndex;
var dropdownValue = document.getElementById('select')[dropdownIndex].text;
//alert(dropdownValue);
<?
$query = "SELECT url FROM " .
"{managelinks } where title='dropdownValue'";
$queryResult = db_query($query);
while ($arr = db_fetch_object($queryResult))
{
?>
alert("$arr[1]");
document.forms[0].cat_name.value= obj.options[obj.selectedIndex].text;
<?
}
?>
</script>
</code>
iam just a begineer in java script,and i tried my program that load data from a database in combo box,my table is managelinks that contain 2 fields title and url ,the title column is loaded in combo box and i tried when the user changes the value of this combo box i select from database the crossponding url and open it ,but it doesnot work well,
this is the code
<code>
<select onchange="address(this)" name="select" id="select">'
<script>
function address(obj)
{
var dropdownIndex = document.getElementById('select').selectedIndex;
var dropdownValue = document.getElementById('select')[dropdownIndex].text;
//alert(dropdownValue);
<?
$query = "SELECT url FROM " .
"{managelinks } where title='dropdownValue'";
$queryResult = db_query($query);
while ($arr = db_fetch_object($queryResult))
{
?>
alert("$arr[1]");
document.forms[0].cat_name.value= obj.options[obj.selectedIndex].text;
<?
}
?>
</script>
</code>