Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.