Drop down form to mysql help

Please can someone see where i am going wrong with this code. When I click submit it does not update mysql database.

The first 2 php codes are fine retrieving the names1 and name2 from the database. The problem is the drop down menu. When selected and click submit it does not insert to mysql. It is bugging me!


// Include database connection settings
include('connect.inc');

//SHOW NAMES FROM LOGIN
$sql = "SELECT name1 FROM user WHERE username = '" . mysql_real_escape_string($_SESSION['username']) . "'";
$result = mysql_query($sql) or die("Error in SQL: " . mysql_error());
$row = mysql_fetch_array($result);
echo $row['name1'];
?>
&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>  <?
// Include database connection settings
include('connect.inc');

//SHOW SECOND NAME FROM LOGIN

$sql = "SELECT name2 FROM user WHERE username = '" . mysql_real_escape_string($_SESSION['username']) . "'";
$result = mysql_query($sql) or die("Error in SQL: " . mysql_error());
$row = mysql_fetch_array($result);
echo $row['name2'];
?>

// THE PROBLEM IS THE FOLLOWING CODE:

&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><form action="$_POST['submit']" method="post">
      <label>sport
        <select name="sport" id="sport">
          <option>footy</option>
          <option>tennis</option>
          <option>rugby</option>
        </select>
      </label>
      <label>button
        <input type="submit" name="button" id="button" value="Submit">
      </label>
    </form>

    <?
   $sql = "UPDATE user SET sport = '" . mysql_real_escape_string($_POST['sport']) . "' WHERE username = '" . mysql_real_escape_string($_SESSION['username']) . "'";
mysql_query($sql) or die("Error in SQL: " . mysql_error());
?>

</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><p>
    <p>            <p></p></td>
  </tr>
</table>
<p>&nbsp;</p>

</body>
n
</html>


thanks

fixed

I’m glad you found the solution. Would you mind telling us how you fixed it?