嗨如何保存會話中的數據,當我們點擊保存按鈕,並需要在數據庫中提交數據時,我點擊提交按鈕。這裏是我的表格。如何在php中點擊保存按鈕後在會話中存儲數據,並點擊提交按鈕後提交數據
的index.php
<form method="post" action="personal.php" id="myform">
<label>First Name</label>
<input type="text" name="first_name" value="" />
<label>Last Name</label>
<input type="text" name="last_name" value="" />
<button class = "medium" style="background-color: #2daebf;">Save</button>
Personal.php
$connection = mysql_connect("localhost", "root", "") or die(mysql_error());
$db = mysql_select_db("accountant", $connection);
$firstname = $_POST['first_name'];
$lastname=$_POST['last_name'];
$query=mysql_query("INSERT INTO table(first_name,last_name)values("$firstname","$lastname")");
我如何存儲這些數據到會話和重定向到indexs.php有一次我在點擊提交按鈕,總數據需要插入到數據庫中。
indexs.php
<form method="post" action="personals.php" id="myform">
<label>Address</label>
<input type="text" name="address" value="" />
<label>Pincode</label>
<input type="text" name="pin" value="" />
<button class = "medium" type="submit" style="background-color: #2daebf;">Save</button>
Personals.php
$connection = mysql_connect("localhost", "root", "") or die(mysql_error());
$db = mysql_select_db("accountant", $connection);
$address = $_POST['address'];
$pin=$_POST['pin'];
$query=mysql_query("INSERT INTO table(address,pin)values("$address","$pin")");
你想在SESSION中存儲哪些數據? –
你的問題非常混亂。你已經寫了兩次相同的代碼。你想要什麼? – Drudge
我在index.php中輸入的數據,我需要將數據存儲在會話中,並且需要重定向到indexs.php – user5891511