I need help with this. I am sure its an easy thing.. but I am stumped for some dumb reason....

all this works just fine.. but what I want to echo out is fname and lname of each person once they are selected as well as the next section of code I have... I guess what I am asking in short is how to set or create variables based on the array being pulled?

$selected_player = addslashes($_POST);
$query="SELECT * FROM player ORDER BY lname ";
$result=mysql_query($query);

echo "<option selected>-- Select Player --</option>";
while ($row=mysql_fetch_array($result)) {
if ($row > 0) {
echo '<option value="'.$row.'">'.$row.' '.$row.'</option>';
//$fname = $row;
}

else {
print("<option value=\"\">No Players On Roster</option>");
}
}

//mysql_close;
?>

Try replacing your code with this:

$query="SELECT * FROM player ORDER BY lname ";
$result=mysql_query($query); 

echo "<option selected>-- Select Player --</option>";
if (mysql_num_rows($result)>0) {
print("<option value=\"\">No Players On Roster</option>");
} else {
while ($row=mysql_fetch_assoc($result)) { 
echo '<option value="'.$row['id'].'">'.$row['fname'].' '.$row['lname'].'</option>';
}
}
//mysql_close;
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.