i want to create a form wizard, but i am not getting my forms one after another in one page. i am using <input type="hidden" name="step" value="1" />
, <input type="hidden" name="step" value="2" />
to get my forms step by step, when i forwarded from up_account.php to update_step1.php, then my form do not get update_step2.php, it goes back to up_account.php, why it is happening, help to get rid of this. advance thanx to all.
function displayStep1() {
include 'update_step1.php';
}
function displayStep2() {
include 'update_step2.php';
}
function displayStep3() {
include 'update_step3.php';
}
function displayComplete() {
include 'update_step4.php';
}
function displaySuccess() {
include 'update_step5.php';
}
function processStep1() {
displayStep2();
}
function processStep2() {
if ( isset( $_POST["continue"] ) and $_POST["continue"] =="< Back" ) {
displayStep1();
}
else {
displayStep3();
}
}
function processStep3() {
if ( isset( $_POST["continue"] ) and $_POST["continue"] =="< Back" ) {
displayStep2();
}
else {
displayComplete();
}
}
function processStep4() {
if ( isset( $_POST["complete"] ) and $_POST["complete"] =="< Back" ) {
displayStep3();
}
else {
displaySuccess();
}
}
if ( isset( $_POST["up_login"] ) and $_POST["up_login"] == 'up_login' ) {
include 'forms/up_login.php';
}
else if ( isset( $_POST["up_info"] ) and $_POST["up_info"] == 'up_info' ) {
if ( isset( $_POST["step"] ) and $_POST["step"] >= 1 and $_POST["step"]<= 5 ) {
call_user_func( "processStep" . (int)$_POST["step"] );
}
else {
displayStep1();
}
}
else {
include 'forms/up_account.php';
}
up_account.php
<form id="add_info" action="" method="post" enctype="multipart/form-data">
<ul>
<li><input type="submit" name="up_info" value="up_info" /></li>
<li><input type="submit" name="up_login" value="up_login" /></li>
</ul>
</form>
update_step1.php
<form id="add_info" action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="step" value="1" />
<ul>
<li>Email</li>
<li><input type="text" /></li>
<li>Phone</li>
<li><input type="text" /></li>
<li><input type="submit" name="continue" /></li>
</ul>
</form>
update_step2.php
<form id="add_info" action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="step" value="2" />
<ul>
<li>Age</li>
<li><input type="text" /></li>
<li>Gender</li>
<li><input type="text" /></li>
<li><input type="submit" name="continue" /></li>
</ul>
</form>