Hi how to save the data in session when we click on save button and need to submit the data in database when i click on submit button.Here is my form.
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")");
How can i store these data into sessions and redirect to indexs.php and once i click on submit button total data needs to be inserted into database.
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")");