<form action="" method="POST">
<input type="text" name="bill_no" placeholder="Bill no" />
<input type="text" name="patient_name" placeholder="Patient name" />
<input type="date" name="bill_date">
<input type="submit" name="submit" value="Submit">
</form>
PHP代码:
<?php
// Connecting to database
include "connect.php";
if (ISSET($_POST['submit']))
{
$bill_no = $con->real_escape_string($_POST['bill_no']);
$patient_name = $con->real_escape_string($_POST['patient_name']);
$bill_date = $con->real_escape_string($_POST['bill_date']);
$query = "INSERT INTO bills(bill_no, patient_name, bill_date) VALUES (?,?,?)";
$stmt = $con->prepare($query);
$stmt->bind_param("sss", $bill_no, $patient_name, $bill_date);
$stmt->execute(); }
$con->close();
?>
我有其可以在由多个用户每次访问的形式。在我的形式,我需要一个场(比如bill_no)应自动递增当过用户打开的形式,如果用户不提交表单或意外关闭浏览器窗口中的值应予以销毁,并应不会保存在我的数据库中。所述bill_no应立即示出如果用户打开其应当由一个先前的bill_no递增的形式。谢谢。
把你的代码,请,你尝试过什么呢。实际上 – rahul
@rahul我没有任何想法如何解决我的问题。我只是有这个概念。你的意思是 – Naresh
没有提交表单,ID值自动递增?下一个用户 – Karthi