title: All PHP drop down list items appearing as "array"
body: <p>My code is simply intending to populate two drop down lists with the names of teams and use the users selections to manipulate the points value of those teams. As a trivial example, pick 2 teams and add both their corresponding scores together. </p>
  
  <p>My main problem is trying to get both the users team selection and the corresponding points stored in variables so I can use them. I'm not very familiar with using arrays or how to retreive the value I want. 
  I can retrieve just the name easily but when I try to retrieve both points and names it populates the ddl incorrectly with "array" in every position. (It's hosted online here: </p>
  
  <p>My code is below, I'm not sure if the problem is with how I'm creating my drop down list or how I'm retrieving the data. </p>
  
  <p>Thanks for your help</p>
  
  <pre><code>&lt;?
  require_once 'login.php';
   $db_server = mysql_connect($db_hostname, $db_user, $db_password);
   if (!$db_server) die("Unable to connect to MySQL: " . mysql_error());
   mysql_select_db($db_database)
   or die("Unable to select database: " . mysql_error());
  
   $sql="SELECT team, points FROM teams";
   $result=mysql_query($sql);
  
   $options="";
  
   while ($row=mysql_fetch_array($result)) {        
  $team[$row["team"]]=$row["points"];  
  $options.="&lt;OPTION VALUE=\"$team\"&gt;".$team. '&lt;/OPTION&gt;';        
   }
  
  
   if (isset($_POST['teamA'])) $teamA = $_POST['teamA'];
   else $teamA = "(Not entered)";
   if (isset($_POST['teamB'])) $teamB = $_POST['teamB'];
   else $teamB = "(Not entered)";
  
   $teamA = htmlspecialchars($teamA);
   $teamB = htmlspecialchars($teamB);
  
   ?&gt;
   &lt;body&gt;
   You picked &lt;?php echo $teamA; ?&gt;(with &lt;?php echo $team[$teamA]; ?&gt; points) 
   and &lt;?php echo $teamB; ?&gt;(with &lt;?php echo $team[$teamB]; ?&gt;) 
   &lt;/br&gt;
  
   &lt;form method="post" action="ddl.php"&gt;
  
   Team A: 
   &lt;SELECT NAME=teamA&gt;
   &lt;OPTION VALUE=0&gt;Choose
   &lt;?=$options?&gt;
   &lt;/SELECT&gt;
  
   Team B:
   &lt;SELECT NAME=teamB&gt;
    &lt;OPTION VALUE=0&gt;Choose
    &lt;?=$options?&gt;
    &lt;/SELECT&gt;
  
    &lt;input type="submit" /&gt;
  
    &lt;/form&gt;
     &lt;/body&gt;
  </code></pre>