I'm trying to create a number of dropdown boxes based on the number of rows returned from a query, which will be different for a number of users.
below is some persuedo code of what i have done.
Code: Select all
$query = query databse to results to populate dropdown boxes,
$result =mysql_query($query);
$numteams = mysql_num_rows($result);
$noteams = 0;
while($noteams <= $numteams) {
$selectid = 1; // used to give the give select html tag a different name
while ($rowhome = mysql_fetch_array($result)) {
$hometeam = $rowhome ї'database field name'];
$hometeamid = $rowhome ї'database field name'];
print ("<select name=hometeam$selectid>");
print ("<option value=$hometeamid>$homteam</option>");
print ("</select");
$selectid++;
}
$noteams++;
}Now i have the problem getting the script to read the various variables
using $_POST as I do not know how many will be passed. so I have tried the following:
Code: Select all
// having passed a varible called numberteams form the form i try a
// loop put it does not sure if this is posible to do.
$numberteams = $_POSTї'numberteams'];
$selectid = 1;
$noteams = 0;
while ($noteams <= $numberteams)) {
$hometeam.$selectid = $_POSTї'hometeam.$selectid'];
$selectid++
}