0

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

3
Contributors
4
Replies
8
Views
6 Years
Discussion Span
Last Post by joeyxaza
0

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

0

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/

0

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

Edited by jkon: Duplicated post …. (I couldn’t see the post the first time I posted …. )

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.