我正在从我的控制器传回的数据生成这个表,我遇到的问题是,通常情况下,在本例中返回的第一个记录Sephen C.Cox,"add employee“按钮不会重定向我,但对于其余的记录,它是有效的。有人知道问题出在哪里吗?

<fieldset id= "results">
<?php if (isset($results ) And count($results)) : ?>
<table id="box-table-a" summary="Employee Sheet">
<thead>
<tr>
<th scope="col">Employee</th>
<th scope="col">Salary</th>
<th scope="col">Bonus</th>
<th scope="col">Supervisor</th>
<th scope="col">Action</th>
</tr>
<?php foreach ($results as $result) : ?>
<tr>
//Primary key <?php echo $result['Employee_ID!'];?>
<td><span class="Employee_name"><?php echo $result['Employee']; ?> </span></td>
<td><span class="Salary"><?php echo $result['Salary']; ?> </span> </td>
<td><span class="Bonus"><?php echo $result['Bonus']; ?> </span> </td>
<td><span class="Supervisor_name"><?php echo $result['Supervisor']; ?> </span></td>
<form action="welcome.php" method="post"> <td><input type="submit" value="Add employee" name="submit[<?php echo $result['Employee_ID'] ?>]" > </td></form>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</thead>
<tbody>
</fieldset>发布于 2012-08-29 19:07:49
<form action="welcome.php" method="post">
<td>
<input type="submit" value="Add employee"
name="submit[<?php echo $result['Employee_ID'] ?>]" >
</td></form>更改为
<td>
<form action="welcome.php" method="post">
<input type="submit" value="Add employee"
name="submit[<?php echo $result['Employee_ID'] ?>]" >
</form>
或者甚至将整个表格包装成一个表格,而不是将新表格放入每一行。在您的代码中看不到任何可能需要它的原因
编辑:另外,看看像Firebug (FF),Chrome和Safary中的检查器,开发人员工具,或者它在IE中是如何被调用的。用其中一个工具打开您的页面就足够了,注意到浏览器解析的代码并不像您期望的那样。
https://stackoverflow.com/questions/12176431
复制相似问题