Re: select-option link list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Like this. Here's the html code. I'm sure you can convert to the appropriate PHP

<html>
<body>
<form>
<select size="1" name="site" onChange="window.location=this.value">
<option value="http://www.google.com";>Google</option>
<option value="http://www.yahoo.com";>Yahoo</option>
<option value="http://www.microsoft.com";>MS</option>
</select>
</form>
</body>
</html>




On Wed, 19 Jan 2005 20:10:25 +0200, William Stokes <kalles@xxxxxxxxxxxxx> wrote:


Hello,

Hope someone can give some directions...

I'm trying to create a list box of links to other pages. I just can't figure
out how to move to the other page whe user selects one of the options in the
list box.


here's the code...

$sql="SELECT team_name FROM teams";
$result=mysql_query($sql);
$num = mysql_num_rows($result);
$cur = 1;
print "<form name=\"form1\" method=\"post\" action=\"select_team.php\">";
print "<select name=\"select_team\" size=\"1\"  >";
while ($num >= $cur) {
$row = mysql_fetch_array($result);
$team_name = $row["team_name "];
print "<option>$team_name </option>";
$cur++;
}
print "</select>";
print "<input type=\"submit\" value=\"Go!\">";
print "</form>";

This propably can be don without the "Go" button. But i Don't know how...

Thank a lot
-Will
BTW thanks for the debugging stuff earlier. Got that workin...

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux