链接复选框到表行信息

时间:2012-03-07 20:22:27

标签: php

我有一个从mysql中检索学生项目值的表单,这些值由一个复选框引导,所以我想将主管分配给带有复选框的学生,即选中与您想要的学生相对应的复选框指定主管并单击分配主管按钮输入主管名称,然后该主管被分配给被检查的学生,但它不起作用,plis帮助....

<?php
 $dbhost = 'dbhost';

 $dbuser = 'user';

 $dbpass = 'password';

 $dbname = 'db_name';

 $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
 //
 mysql_select_db($dbname,$conn) or die ("Could not open database");
 //
$sql="SELECT * FROM table";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>student.to.assign.supervisor</title>
<style type="text/css">
<!--
.style2 {font-family: Georgia, "Times New Roman", Times, serif;
    font-weight: bold;
    font-style: italic;
    font-size: 18px;
}
-->
</style>
<link href="../css/forms.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="75%" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
    <td height="51"><div align="center">
      <p class="style2">Student Project Management System</p>
      <p class="style2"> with Web Front End </p>
    </div></td>
  </tr>
  <tr>
    <td><hr /></td>
  </tr>
  <tr>
    <td><form action="" method="post" name="form2" id="form2">
      <table width="100%" cellspacing="1" cellpadding="1">
        <tr>
          <td width="77%">&nbsp;</td>
          <td width="10%"><label>
            <input type="submit" name="Submit" value="Logout" />
          </label></td>
          <td width="13%"><label>
            <input type="submit" name="Submit3" value="About Us" />
          </label></td>
        </tr>
      </table>
    </form></td>
  </tr>
  <tr>
    <td><hr /></td>
  </tr>
  <tr>
    <td><form id="form3" name="form3" method="post" action="">
      <table width="100%" cellspacing="1" cellpadding="1">
        <tr>
          <td width="35%" rowspan="2"><label>
            <input type="image" name="imageField" src="../img/project.jpg"  width="325" height="199" border="2" />
          </label></td>
          <td width="65%"><table width="94%" cellpadding="1" cellspacing="1" class="main_table">
            <tr class="table_title">
              <td width="100%" height="31">Students, their Proposed Project and Supervisors </td>
              </tr>
            <tr>
              <td><table width="100%" cellspacing="1" cellpadding="1">
                <tr class="table_head">
                  <td width="3%" height="42"><div align="center"></div></td>
                  <td width="32%"><div align="center">Name</div></td>
                  <td width="36%"><div align="center">Project Proposed</div></td>
                  <td width="29%"><div align="center">Supervised By</div></td>
                </tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
                <tr>
                  <td><div align="center">
                    <input type="checkbox" name="checkbox[]" id="checkbox[]" value="<?php echo $rows['username']; ?>" />
                  </div></td>
                  <td><div align="center"><?php echo $rows[0]; ?></div></td>
                  <td><div align="center"><?php echo $rows[1]; ?></div></td>
                  <td><div align="center"><?php echo $rows[2]; ?></div></td>
                </tr>
<?php
}
?>
              </table>
              </td>
              </tr>
          </table></td>
        </tr>
      </table>
    </form></td>
  </tr>
  <tr>
    <td height="21"><form id="form1" name="form1" method="post" action="../coordinatorAssignSupervisor2.html">
      <table width="100%" cellspacing="1" cellpadding="1">
        <tr>
          <td width="81%">&nbsp;</td>
          <td width="1%"><label></label></td>
          <td width="18%"><input name="AssignSupervisor" type="submit" id="propose" value="Assign Supervisor" /></td>
        </tr>
<?php

}
mysql_close();
?>
      </table>
    </form></td>
  </tr>
</table>
</body>
</html>

0 个答案:

没有答案