【发布时间】:2021-09-16 03:01:06
【问题描述】:
这是输入部分:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="ldbal" value="2000">
<input type="submit" name="btn-signup" class="btnreg" value="Register">
</form>
现在这是我要提交数据的地方,我希望 ldbal 输入中的值“2000”在隐藏时插入到数据库中。
<?php
if(isset($_POST['btn-signup']))
{
$Ldbal = $_POST['ldbal'];
$ins="INSERT INTO customers (Cus_Loadbal) VALUES ('$Ldbal')";
if($conn->query($ins)===TRUE)
{
<div class="alertinfo2">
<strong>Congrats!</strong>
</div>
}
else
{
?>
<div class="alertinfo2">
<strong>Sorry!</strong> Failed to insert. Please try again
</div>
<?php
}
}
?>
但是在检查数据库时,值总是0。你能帮帮我吗?
PS:我删除了部分代码以减少长度。我留下了重要的东西。
【问题讨论】: