I've managed to populate a drop down select with 2 fields from my db...
<?
$connection = mysql_connect("aaa","bbb","ccc"
or die("Couldn't make connection."
;
$db = mysql_select_db("ddd", $connection)
or die("Couldn't select database."
;
$sql = "SELECT * FROM fixtures ORDER BY date ASC";
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query."
;
// put data into drop-down list box
while ($row = mysql_fetch_array($sql_result)) {
$team = $row["team"];
$date = $row["date"];
$option_block .= "<OPTION value=\"$team $date\">$team - $date</OPTION>";
}
?>
<FORM method="POST" action="newpage.php">
<P>Fixture:<br>
<SELECT name="fixture" class="formbox">
<? echo "$option_block"; ?>
</SELECT>
<P><INPUT type="submit" value="submit"></p>
</FORM>
I'm presuming that $fixture gets passed to newpage.php as the string value of '$team $date'?
I need newpage.php to re query my db and select the record where the team and date matches that selected from the previous page... help, my head hurts and as you've probably guessed, I'm not to hot at this stuff!!
TIA
Solfer
<?
$connection = mysql_connect("aaa","bbb","ccc"
or die("Couldn't make connection."
$db = mysql_select_db("ddd", $connection)
or die("Couldn't select database."
$sql = "SELECT * FROM fixtures ORDER BY date ASC";
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query."
// put data into drop-down list box
while ($row = mysql_fetch_array($sql_result)) {
$team = $row["team"];
$date = $row["date"];
$option_block .= "<OPTION value=\"$team $date\">$team - $date</OPTION>";
}
?>
<FORM method="POST" action="newpage.php">
<P>Fixture:<br>
<SELECT name="fixture" class="formbox">
<? echo "$option_block"; ?>
</SELECT>
<P><INPUT type="submit" value="submit"></p>
</FORM>
I'm presuming that $fixture gets passed to newpage.php as the string value of '$team $date'?
I need newpage.php to re query my db and select the record where the team and date matches that selected from the previous page... help, my head hurts and as you've probably guessed, I'm not to hot at this stuff!!
TIA
Solfer