Hello
I'm trying to make a multiple page form, using PEAR's QuickForm. Unfortunately I'm kind of stuck. The values are not passed from one page to the next. (I use $_POST[variable]). What is the most efficient way to make multiple page forms with QuickForm? Any suggestions?
The code I have so far doesn't work... any ideas why?
Thanks a lot.
Dan
require_once 'HTML/QuickForm.php';
$myForm = new HTML_QuickForm('SignupForm','POST');
//set default value
if ($step==""){
$step=1;
}
switch($step){
case 1:
$myForm->addElement('header', '', 'Personal information');
$myForm->addElement('text','textFirst','Firstname',"class=ok");
$myForm->addElement('text','textLast','Lastname',"class=ok");
break;
case 2:
//Save values from previous page
$myForm->addElement('hidden',"Firstname",$_POST[textFirst]);
$myForm->addElement('hidden',"Lastname",$_POST[textLast]);
//Add new form elements
$myForm->addElement('header', '', 'User specific information');
$preflanguage = array("DE"=>"German",
"FR"=>"French",
"IT"=>"Italian",
"EN"=>"English");
$myForm->addElement('select', 'textLanguage', 'Preferred language', $preflanguage);
break;
case 3:
$myForm->addElement('header', '', 'More info');
// select country
$exchangecountry = array("AR"=>"Argentina",
"AU"=>"Australia",
"BE"=>"Belgium",
"BR"=>"Brasil",
"CH"=>"Chile",
"DK"=>"Denmark",
"DE"=>"Germany");
$myForm->addElement('select', 'textCountry', 'Exchange country', $exchangecountry);
break;
}
$myForm->addElement('hidden',"step",$step);
$myForm->addElement('submit','submitButton','Continue');
if($myForm->validate()){
$step++;
header("Location: http://www.mypage.com/test/form.php?step=$step");
}else{
$myForm->display();
}