i have this code thet it's not working and i don't know why can you tell me
<?
// Edit these values {{{
$sql_host = 'localhost';
$sql_user = 'administrator';
$sql_pass = '';
$sql_db = 'test';
// }}} End edit
?>
<script language="JavaScript">
var arItems = new Array()
arItems = [
<?
mysql_connect($sql_host, $sql_user, $sql_pass);
mysql_select_db($sql_db);
$qry = mysql_query('SELECT * FROM temp WHERE parent > 0');
while ($row = mysql_fetch_array($qry)) {
$arr.= '[' . $row['parent'] . ', ' . $row['id'] . ', \'' . $row['name'] . '\'],' . "\n\t";
}
$final = substr($arr, 0, -3);
echo $final;
?>
]
function fillItems( intStart ) {
var fTypes = document.form1.types
var fItems = document.form1.items
var a = arItems
var b, c, d, intItem, intType
if ( intStart > 0 ) {
for ( b = 0; b < a.length; b++ ) {
if ( a[1] == intStart ) {
intType = a[0];
}
}
for ( c = 0; c < fTypes.length; c++ ) {
if ( fTypes.options[ c ].value == intType ) {
fTypes.selectedIndex = c;
}
}
}
if ( intType == null ) {
intType = fTypes.options[ fTypes.selectedIndex ].value
}
fItems.options.length = 0;
for ( d = 0; d < a.length; d++ ) {
if ( a[d][0] == intType ) {
fItems.options[ fItems.options.length ] = new Option( a[d][2], a[d][1] ); // no line-break here
}
if ( a[d][1] == intStart ) {
fItems.selectedIndex = fItems.options.length - 1;
}
}
}
</script>
<form name="form1">
<select name="types" onChange="fillItems(0)">
<option value="#" selected="selected">Please select</option>
<?
mysql_connect($sql_host, $sql_user, $sql_pass);
mysql_select_db($sql_db);
$qry = mysql_query('SELECT * FROM temp WHERE parent = 0');
while ($row = mysql_fetch_array($qry)) {
?>
<option value="<?=$row['id'];?>"><?=$row['name'];?></option>
<?
}
?>
</select>
<select name="items"></select>
</form>
Hi i need som help on php and java
Moderator: General Moderators
can you tell us what it is doing and what it is supposed to do?
Also please use the
Also please use the
Code: Select all
tags