OK this works for me.
I've commented out all your database bits and added hardcoding for the dropboxes. Also put your functions on the same script for easy of debug.
PHP Code:
<?php
function dropdownform ()
{
// $query = mysql_query( "SELECT * FROM `games` ORDER BY `gameid` ASC");
echo "<select name=\"games\" onChange=\"getboards(this.options.selectedIndex)\">";
// while ( $array = mysql_fetch_array( $query ) )
echo '<option value="Select game">Select Game</option>';
echo '<option value="test1">test1</option>';
echo '<option value="test2">test2</option>';
echo '<option value="test3">test3</option>';
echo '<option value="test4">test4</option>';
echo "</select>";
}
function ListMenuForm ()
{
// $query = mysql_query( "SELECT map FROM maps WHERE game_id = '$game'");
echo "<select name=\"boards\" size=\"1\" >";
echo "<option value=\"null\">null</option>";
// while ( $array = mysql_fetch_array( $query ) )
// {
// $row1 = mysql_fetch_row($result);
// echo " <option value={$game}>{$row1[1]}</option>";
// }
echo "</select>";
}
###Matches Input Script###
//require_once ('database.php');
//require_once ('func2.inc.php');
echo "<form name=formname method=post>";
dropdownform();
echo "<br>";
ListMenuForm ();
echo "<input type=submit name=next value=\"Next Step\">";
echo "</form>";
include ('test1.js');
?>
Code:
<script language="JavaScript">
<!--
var games=document.formname.games.options.length
var game=new Array(games)
for (i=0; i<games; i++)
game[i]=new Array()
game[0][0]=new Option("Choose Game","Choose Game")
game[1][0]=new Option("optiontext1","optionvalue")
game[1][1]=new Option("optiontext1","optionvalue")
game[1][2]=new Option("optiontext1","optionvalue")
game[1][3]=new Option("optiontext1","optionvalue")
game[2][0]=new Option("optiontext2","optionvalue")
game[2][1]=new Option("optiontext2","optionvalue")
game[2][2]=new Option("optiontext2","optionvalue")
game[2][3]=new Option("optiontext2","optionvalue")
game[3][0]=new Option("optiontext3","optionvalue")
game[3][1]=new Option("optiontext3","optionvalue")
game[3][2]=new Option("optiontext3","optionvalue")
game[3][3]=new Option("optiontext3","optionvalue")
game[4][0]=new Option("optiontext4","optionvalue")
game[4][1]=new Option("optiontext4","optionvalue")
var temp=document.formname.boards
function getboards(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<game[x].length;i++){
temp.options[i]=new Option(game[x][i].text,game[x][i].value)
}
temp.options[0].selected=true
}
//-->
</script>
Bookmarks