我创建了一个填充包含客户数据的数据库的表单。我想要做的是,当isset($_POST["submit"])
时,GET参数会附加到网址,例如&customer=<?php echo $last_id ?>
其中$last_id = mysqli_insert_id($connection);
这可能吗?这是一个插入GET数组的真正的GET参数吗?是否也可以使用这个新添加的参数填充表单?
非常感谢!
这是代码,简化
<?php
if(isset($_POST["submit"]) {
$nome_paciente = mysql_pre($_POST["nome"]);
$query = "INSERT INTO pacientes (";
$query .= "id, nome";
$query .= ") VALUES (";
$query .= "$id, \"{$nome_paciente}\"
$query .= ")";
$result = mysqli_query($connection, $query);
?>
<form action="cadastro_paciente.php?subject=1&paciente=<?php echo $_POST["id"]; ?>" method="post" class="form-cadastro">
<div class="first-value">
<p class="opensans">Nome: </p>
<input type="text" class="table-nome" name="nome" value="<?php echo $nome ?>">
</div>
<input type="text" class="id" name="id" style="display:none" value="$_GET['id']">
<?php } else { ?>
<form action="cadastro_paciente.php?subject=1&paciente=<?php echo $_POST["id"]; ?>" method="post" class="form-cadastro">
<div class="first-value">
<p class="opensans">Nome: </p>
<input type="text" class="table-nome" name="nome" value="<?php echo $nome ?>">
</div>
<input type="text" class="id" name="id" style="display:none" value="$_GET['id']">
?php } ?>
但我不断进入我的网址:
&paciente=<br%20/><b>Notice</b>:%20%20Undefined%20index:%20id%20in%20<b>C:\xampp\htdocs\...
由于