0

Hi,

I am trying to build a multipage php form using mysql as the backend much like the ones in monster.com.

First page with the personal details
Second page with educational details
Third page with work experience details

Can some one please give me a thread or a link or a source for me to get started.

Thanks much for the help.

4
Contributors
4
Replies
40
Views
9 Years
Discussion Span
Last Post by buddylee17
0

Basically, how it works is you use a form on each page.:
page1.php

<form method="post" action="page2.php">
First Name:<input type="text" name="first_name" /><br>
Last Name:<input type="text" name="last_name"  /><br>
<input type="submit" name="submit" />
</form>

Then in page 2, you echo the variables from page 1 into hidden fields in the form for use on page 3:
page2.php

<?php
$fname=$_POST['first_name'];
$lname=$_POST['last_name'];
?>
<html>
<head></head>
<body>
<form method="post" action="page3.php">
<input type="hidden" name="first_name" value="<?php echo $fname;?>" />
<input type="hidden" name="last_name" value="<?php echo $lname;?>" />
Education:<input type="text" name="education" /><br>
School:<input type="text" name="school" /><br>
<input type="submit" name="submit" />
</form>
</body>
</html>

The same goes for page 3:
page3.php

<?php
$fname=$_POST['first_name'];
$lname=$_POST['last_name'];
$education=$_POST['education'];
$school=$_POST['school'];
?>
<html>
<head></head>
<body>
<form method="post" action="page4.php">
<input type="hidden" name="first_name" value="<?php echo $fname;?>" />
<input type="hidden" name="last_name" value="<?php echo $lname;?>" />
<input type="hidden" name="education" value="<?php echo $education;?>" />
<input type="hidden" name="school" value="<?php echo $school;?>" />
Experience:<input type="text" name="experience" /><br>
<input type="submit" name="submit" />
</form>
</body>
</html>

Now, all the variables from all 3 pages are posted to page 4.
Hope this helps

0

i use a session array to hold the values and at the very end pull the data from the array and process it into a database.

0

I would go with sessions too . They are a better and neat way of doing this.

To start a session

session_start();

To write variables into session

$_SESSION[variable_name] = variable_value;

To end a session

session_destroy();

remember to use session_start() at the top of every page that you want your session variables to be readable :)

0

Yes, the session would work. Cookies would work as well. The code I posted was meant to build a basic understanding of passing variables from page to page.

This topic has been dead for over six months. 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.