Dear All,

Hi, i am new to php, and i will like to create a Multiple Page Form, the issue is that i dont know how to save the variables from the first form all through to the last form, so that i can save all the form fields into a database at the last form, the first form should have a next-button that takes you to the next form.

the main issue is saving the data after each form till the last form

thank you

Session could do the job and more over you could validate this way that the correct (application logic) path have been fallowed.

there are several ways you can do this, Here's some I can think of:

- Use hidden fields

//on the first form
<form action = 'form2.php' method = 'post'>
//on the second form
<form action = 'form3.php' method = 'post'>
   //put the value from the prev form
   <input type='hidden' name='option1' value = '<?php echo $_POST['option1']; ?>' />
</form>

- Use sessions

//when submit button is clicked
if(isset($_POST['submit'])){
   $_SESSION['option1'] = $_POST['value'];
}

- Transactions, this requires you to insert into the database after each form is submitted but should anything happen, you can still rollback any changes. read more here

- Use Tabs instead. I guessing the reason you want to have multiple forms is because you have a step1 2 3 process for a better user interface. you could just hide all the forms using javascript or Jquery and place them in tabs but it can get fairly complicated. http://jqueryui.com/demos/tabs/

Duplicated post …. (I couldn’t see the post the first time I posted …. )

thanks all for your wonderful help