Form post Send data to another page , verify and then post

I have a form with ,

In the form after user clicks on Submit , he will be taken to another page which would show all the data entered, Which would allow the user to verify the content.(User will have a look at the content , to see what he entered is correct).

Once user verifies he would submit the data and Insert to DB should be done.

I want to know a method in which i could carry on the approach, to do this.

How can i implement this

EDIT MORE EXPLAIN

addemp.php

The Main Div With Form

<div class="panel-body">
<form>
Employee : <input Type="text" id="name">
<input type="submit" value="check">
</div>

The Second Div in the same form should show once submit is clicked

<div class="submit panel-body">
<form>
Employee : <Employee Name asin main div>
<input type="submit" > <--! this submit would post data
</form>
</div>

how to pass the value from 1st div to the second , and from the second INSERT to db.how can i do without page refresh ?

Answers


Use following script on location file

$action='';

if(isset($_POST['submit'])){
//create form here
//Change the action of form
$action = 'save.php';
}
echo '<form method="POST" action="'.$action.'">
<input type="text" name="nric" value="'.isset($_POST['nric'])?$_POST['nric'].'" />
<input type="text" name="empName" value="'.isset($_POST['empName'])?$_POST['empName'].'" />
<input type="text" name="location" value="'.isset($_POST['location'])?$_POST['location'].'" />
<input type="submit" value="Submit"/>
</form>';

EDIT: You don't need to use a form in this case. You can simply use JQuery to show the data from text boxes in a DIV and a button that will POST the data for you on the server.

    <input type="text" name="nric"  id="nric" />
    <input type="text" name="empName" id="empName" />
    <input type="text" name="location" id="location" />
    <input id="sndData" type="button" value="Submit" />

<div id="showData"></div>

JQuery:

$('#sndData').click(function(){
    var makeData = "<p>NRIC: "+$('#nric').val()+"</p><p>Employee Name: "+$('#empName').val()+"</p><p>Location: "+$('#location').val()+"</p>";
    $('#showData').html(makeData);
});

When you've done that, just create/show a HTML button that will POST the data for you. If this answers your question, please mark it as an answer.


Need Your Help