Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/91.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP表单输出_Php_Html - Fatal编程技术网

PHP表单输出

PHP表单输出,php,html,Php,Html,我根据从控制器传回的数据生成这个表。我遇到的问题是,一般来说,返回的第一条记录[在本例中是Sephen C.Cox],“add employee”(添加员工)按钮不会重定向我,但它对其余记录有效。有人知道这个问题吗 <fieldset id= "results"> <?php if (isset($results ) And count($results)) : ?> <table id="box-table-a" summary="

我根据从控制器传回的数据生成这个表。我遇到的问题是,一般来说,返回的第一条记录[在本例中是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>


雇员
薪水
奖金
监督人
行动
//主键


你试过不同的浏览器吗?我猜这可能是由“提交按钮名称”属性引起的。我只需将名称与值和值切换为名称。编辑还可以对非法值字符的值进行转义。在
之外创建一个表单很奇怪。另外,在设置表单时,最好通过隐藏输入类型传递员工ID。您能给我一个示例,说明如何传递然后在控制器中调用它吗?
<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>