php - 在表单表引导程序中发布方法 PHP
问题描述
嗨,所有stackoverflow用户都直接放置基本方法,以便通过PHP中的method =“POST”将数据从一个页面传输到另一个页面:
表格.php:
<?php
session_start();
include '../connessione.php';
$id = $_SESSION['id'];
$query_string = "select * from ca2_2ac_clienti";
$query = mysqli_query($connessione, $query_string);
?>
<?php
while($row = mysqli_fetch_assoc($query)){ ?>
<form action="test.php" method="post">
<input name="text" value="<?php echo $row['id_cliente'] ;?>">
<input type="submit" name="invia">
</form>
<?php } ?>
测试.php:
<?php $text = $_POST['text']; ?>
<form action="test.php" method="post">
<input name="text" value="<?php echo $text;?>">
<input type="submit" name="invia">
</form>
到这里为止没问题,当我想在while循环内的表中实现它时,问题就出现了,即在我的表单中的值中我看不到任何类似的东西?
放置代码:
<?php
while($row = mysqli_fetch_array($result))
{
?>
<!--Table body-->
<tbody>
<tr>
<th scope="row">
<label class="form-check-label" for="checkbox1" class="label-table"></label>
</th>
<form action="test.php" method="post">
<td style="vertical-align: middle;">
<input name="text" value="<?php echo $row['codice_impianto'] ;?>">
</td>
<a href="#modifica<?php echo $row['id_impianto']; ?>" data-toggle="modal" class="btn btn-sm btn-warning btn-rounded"><span class="glyphicon glyphicon-edit"></span> MODIFICA</a>
<a href="#elimina<?php echo $row['id_impianto']; ?>" data-toggle="modal" class="btn btn-sm btn-danger btn-rounded"><span class="glyphicon glyphicon-trash"></span> ELIMINA</a>
<input type="submit" name="invia">
</form>
<?php include('modali.php'); ?>
</td>
</tr>
</tbody>
<?php
}
}
else
{
echo 'Nessun risultato corrisponde alla tua ricerca';
}
?>
解决方案
该<form>
元素不允许是<table>
,<tr>
或<tbody>
元素的后代。您应该<form>
在整个<table>
元素周围放置
推荐阅读
- c# - 获取扫描仪 zebra se2707 的状态
- django - 如何使用 django 将日期保存到数据库中?
- r - 对 lmer 使用 emmeans
- date - 如何在 PSPP 中找到几个日期的最小值
- sql - CTE 在 SSAS Cube 中不起作用。我想找到解决方案或将其转换为子查询
- excel - 如何强制 Excel 重新提交(重新执行)函数?
- rest - HTTP 客户端 Android Studio
- python - 在单独的线程中,我的模型的预测功能出现问题
- reactjs - React中如何根据其后代的className更改组件的className?
- sql-server - 无法通过 VB.net 连接到 SQL Server,但我可以使用相同的凭据从 SSMS 登录到服务器