php代码从两个表单中获取值并将其插入表中

I have two forms on one page. First one take names of students according to group. Second form is used to enter marks individually. Now i want to insert their marks but failed to do this. Kindly help me regarding this. My code is:

$faculty = null; //declare vars

$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Not connected : ' . mysql_error());
}
mysql_select_db('Sims', $link) or die("cannot select DB");

 if(isset($_POST["faculty"]))
  {
      $faculty = $_POST["faculty"]; 
   }
   ?>
 <script language="JavaScript">
 function autoSubmit()
 {
  var formObject = document.forms['theForm'];
  formObject.submit();
  }
</script>
 <form name="theForm" method="post">
<select name="faculty" onChange="autoSubmit();">
    <option value="null"></option>
    <option value="computer" <?php if($faculty == 'computer') echo "    selected"; ?>>Computer</option>
    <option value="commerce" <?php if($faculty == 'commerce') echo " selected"; ?>>Commerce</option>
</select>
 <br><br>
<?php
if($faculty =='computer')
{
echo "<select name=\"name\">";
$sql =  mysql_query("SELECT name FROM std_reg where faculty= 'computer' ") or die(mysql_error()); 
while($row = mysql_fetch_array($sql)){
echo "<option>".$row[name]."</option>";}
echo "</select>";
}

if($faculty =='commerce')
{
echo "<select name=\"name\">";
$sql =  mysql_query("SELECT name FROM std_reg where faculty= 'commerce' ") or die(mysql_error());
while($row = mysql_fetch_array($sql)){
echo "<option>".$row[name]."</option>";}
echo "</select>";
}
?>
<br><br>
</form>
<form method="post">
math <input type="text" name="urdu" />
science <input type="text" name="science" />
social <input type="text" name="social" />

<a href="insertmarks.php">submit</a>
</form>