I am not getting any error messages...The GAMES dropdown box is populating just fine....But I think that's because I am still using the query in my func2.inc.php...
This will take me some time..But I think that it will be well worth it in the end.
Again...No error messages
Main Page
Code:
<?php
###Matches Input Script###
require_once ('database.php');
require_once ('func2.inc.php');
include ('test1.js');
echo "<form name=formname method=post>";
dropdownform();
echo "<br>";
ListMenuForm ();
echo "<input type=submit name=next value=\"Next Step\">";
echo "</form>";
?>
func2.inc.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={$array['gameid']}>{$array['game_name']}</option>";
}
echo "</select>";
}
function ListMenuForm ()
{
$query = mysql_query( "SELECT map FROM maps WHERE game_id = '$game'");
echo "<select name=\"boards\" size=\"5\" multiple>";
while ( $array = mysql_fetch_array( $query ) )
{
$row1 = mysql_fetch_row($result);
echo " <option value={$game}>{$row1[1]}</option>";
}
echo "</select>";
}
?>
Then the javascript
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("optiontext","optionvalue")
game[0][1]=new Option("optiontext","optionvalue")
game[0][2]=new Option("optiontext","optionvalue")
game[1][0]=new Option("optiontext","optionvalue")
game[1][1]=new Option("optiontext","optionvalue")
game[1][2]=new Option("optiontext","optionvalue")
game[1][3]=new Option("optiontext","optionvalue")
game[2][0]=new Option("optiontext","optionvalue")
game[2][1]=new Option("optiontext","optionvalue")
game[2][2]=new Option("optiontext","optionvalue")
game[2][3]=new Option("optiontext","optionvalue")
game[3][0]=new Option("optiontext","optionvalue")
game[3][1]=new Option("optiontext","optionvalue")
game[3][2]=new Option("optiontext","optionvalue")
game[3][3]=new Option("optiontext","optionvalue")
game[4][0]=new Option("optiontext","optionvalue")
game[4][1]=new Option("optiontext","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>
Like I said..I know nothing about js..so maybe I am missing a whole lot of stuff! lol
Bookmarks