按钮没有放入Php echo表中

时间:2018-06-12 21:36:13

标签: php

所以我有这个代码,它是行的删除按钮,但是除了第一个按钮,它作为值idk的提交按钮时,它的工作方式完美。我已经失去了如何将它们放在他们的位置(在删除下)以及如何修复第一个按钮

代码:

    echo "<tr>";
    echo "<td>". $row["id"] . "</td>";
    echo "<td></td>";
    echo "<td>". $row["shelllink"] . "</td>";
    echo "<td>". $row["shellprice"] . "</td>";
    echo " <form action='delete.php' method='post' class='deletePHP'>
                    <input type='hidden' name='id' value='".$row['id']."'/>
                    <input type='submit' name='delete' value='delete'/>
                </form>";
    echo "</tr>";
}
echo "</table>";

现在表格的情况:

enter image description here

<div class="content">
        <form action="shellinsert.php" method="post">
<p>
    <label for="firstName">Link:</label>
    <input <input type="url" name="shelllink" required/ size="160"><br>
</p>
<p>
    <label for="firstName">Price:</label>
    <input <input type="number" name="shellprice" required/ min="1" max="1000" size="160"><br>
</p>
<input type="submit" value="Submit">

1 个答案:

答案 0 :(得分:1)

表格行中的所有内容都必须位于<td></td>内。

echo " <td><form action='delete.php' method='post' class='deletePHP'>
                <input type='hidden' name='id' value='".$row['id']."'/>
                <input type='submit' name='delete' value='delete'/>
            </form></td>";