我不知道为什么在修改表单中可以在另一个文件中使用的查询,而不是更改另一个文件,而是使用这种方式通过另一个页面检索记录的值:
<?php echo "<a href='test.php?id_rich_dis={$row['ID_Richiesta']}' type='button'><i class='fas fa-info-circle fa-1x'></i></a>"; ?>
这是我的表格:
<?php session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?>
<!-- RECOVER THE ID OF THE REQUEST AND SELECT ALL OF ITS VALUES FROM THE RISP_RICH.PHP PAGE -->
<?php
include 'connection/cnt.php';
$id_richiesta = $_GET['id_rich_dis'];
$query_string = "SELECT * FROM richieste WHERE ID_Richiesta = '$id_richiesta'";
$query = mysqli_query($connessione, $query_string);
?>
<!-- FORM AND CONTROL INSTRUCTIONS -->
<?php
if (isset($_POST['test'])) {
$id = $connessione->real_escape_string($_POST['ID_Richiesta']);
$id_professionista_da_modificare = $connessione->real_escape_string($_POST['id_professionista']);
$connessione->query("UPDATE richieste SET
ID_Collaboratore='$id_professionista_da_modificare',
WHERE ID_Richiesta ='$id'");
}
?>
<form action="test.php" method="post">
<!-- PERFORM A WHILE CYCLE TO EXIT ALL VALUES OF THE QUESTION IN QUESTION -->
<?php while($row = mysqli_fetch_assoc($query)){ ?>
<input value="<?php echo $row['ID_Richiesta']; ?>" name="ID_Richiesta">
<input type="text" name="id_professionista" value="2"><br>
<?php } ?>
<input id="test" value="MODIFICA" name="test" type="submit">
</form>
但更改未成功,但出现此错误
Notice: Undefined index: id_rich_dis
但是我不知道为什么
答案 0 :(得分:0)
检查变量'$ id_richiesta'的内容是什么,因为其值为$ _GET ['id_rich_dis']。 因此,要使其未定义就意味着$ _GET ['id_rich_dis']不返回值。 从那里开始查看,并检查所有内容是否都用小写字母,因为某些问题是由区分大小写引起的。