Jump to content

[SOLVED] Forms and PHP


Daney11

Recommended Posts

Hi guys.

 

I have some information inside a database that i want to extract into a select form.

 

<td width="163" height="20">
<?php

$strQuery = "SELECT team_id, team_name FROM `teams` WHERE team_id > 0";
$result = mysql_query($strQuery,$db) or die(mysql_error());

while ($teamrow = mysql_fetch_array($result))

{

$team_id = mysql_real_escape_string($teamrow['team_id']);
$team_name = mysql_real_escape_string($teamrow['team_name']);


?>
<select class="shoutbox" name="player_club" type="text" maxlength="10">
<option value="<?php echo "$team_id" ?>"><?php echo "$team_name" ?></option></select>
<?php

}

?>
</td>

 

This peice of code works, but extracts all the information in my database into a select box each, so i have over 100 select boxes, where i want all the names into one select box that you can select in the form and the team_id will be the value corresponding to the team name.

 

Thanks guys

 

Dane

Link to comment
https://forums.phpfreaks.com/topic/46905-solved-forms-and-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.