gnarl Posted January 16, 2009 Share Posted January 16, 2009 I am trying to create a Multy Step Application Form for my website so that users answer some questions i ask, then preview the data they inserted and then when pressing the Finish button their Application Form will be posted on my website forum. my problem : at the last step they see their inserted data correctly and it stops there i am stuck in how to create that if they press the Finish button their Application posts in my Website forum. here is my code: ZervWizard.class.php <?php /** * Copyright 2005 Zervaas Enterprises (www.zervaas.com.au) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * ZervWizard * * A class to manage multi-step forms or wizards. This involves managing * the various steps, storing its values and switching between each * step * * @author Quentin Zervaas */ class ZervWizard { // whether or not all steps of the form are complete var $_complete = false; // internal array to store the various steps var $_steps = array(); // the current step var $_currentStep = null; // the prefix of the container key where form values are stored var $_containerPrefix = '__wiz_'; // an array of any errors that have occurred var $_errors = array(); // key in container where step status is stored var $_step_status_key = '__step_complete'; // key in container where expected action is stored var $_step_expected_key = '__expected_action'; // options to use for the wizard var $options = array('redirectAfterPost' => true); // action that resets the container var $resetAction = '__reset'; /** * ZervWizard * * Constructor. Primarily sets up the container * * @param array &$container Reference to container array * @param string $name A unique name for the wizard for container storage */ function ZervWizard(&$container, $name) { if (!is_array($container)) { $this->addError('container', 'Container not valid'); return; } $containerKey = $this->_containerPrefix . $name; if (!array_key_exists($containerKey, $container)) $container[$containerKey] = array(); $this->container = &$container[$containerKey]; if (!array_key_exists('_errors', $this->container)) $this->container['_errors'] = array(); $this->_errors = &$this->container['_errors']; } /** * process * * Processes the form for the specified step. If the processed step * is complete, then the wizard is set to use the next step. If this * is the initial call to process, then the wizard is set to use the * first step. Once the next step is determined, the prepare method * is called for the step. This has the method name prepare_[step name]() * * @todo Need a way to jump between steps, e.g. from step 2 to 4 and validating all data * @param string $action The step being processed. This should correspond * to a step created in addStep() * @param array &$form The unmodified form values to process * @param bool $process True if the step is being processed, false if being prepared */ function process($action, &$form, $process = true) { if ($action == $this->resetAction) { $this->clearContainer(); $this->setCurrentStep($this->getFirstIncompleteStep()); } else if (isset($form['previous']) && !$this->isFirstStep()) { // clear out errors $this->_errors = array(); $this->setCurrentStep($this->getPreviousStep($action)); $this->doRedirect(); } else { $proceed = false; // check if the step to be processed is valid if (strlen($action) == 0) $action = $this->getExpectedStep(); if ($this->stepCanBeProcessed($action)) { if ($this->getStepNumber($action) <= $this->getStepNumber($this->getExpectedStep())) $proceed = true; else $proceed = false; } if ($proceed) { if ($process) { // clear out errors $this->_errors = array(); // processing callback must exist and validate to proceed $callback = 'process_' . $action; $complete = method_exists($this, $callback) && $this->$callback($form); $this->container[$this->_step_status_key][$action] = $complete; if ($complete) $this->setCurrentStep($this->getFollowingStep($action)); // all ok, go to next step else $this->setCurrentStep($action); // error occurred, redo step // final processing once complete if ($this->isComplete()) $this->completeCallback(); $this->doRedirect(); } else $this->setCurrentStep($action); } else // when initally starting the wizard $this->setCurrentStep($this->getFirstIncompleteStep()); } // setup any required data for this step $callback = 'prepare_' . $this->getStepName(); if (method_exists($this, $callback)) $this->$callback(); } /** * completeCallback * * Function to run once the final step has been processed and is valid. * This should be overwritten in child classes */ function completeCallback() { } function doRedirect() { if ($this->coalesce($this->options['redirectAfterPost'], false)) { $redir = $_SERVER['REQUEST_URI']; $redir = preg_replace('/?' . preg_quote($_SERVER['QUERY_STRING'], '/') . '$/', '', $redir); header('Location: ' . $redir); exit; } } /** * isComplete * * Check if the form is complete. This can only be properly determined * after process() has been called. * * @return bool True if the form is complete and valid, false if not */ function isComplete() { return $this->_complete; } /** * setCurrentStep * * Sets the current step in the form. This should generally only be * called internally but you may have reason to change the current * step. * * @param string $step The step to set as current */ function setCurrentStep($step) { if (is_null($step) || !$this->stepExists($step)) { $this->_complete = true; $this->container[$this->_step_expected_key] = null; } else { $this->_currentStep = $step; $this->container[$this->_step_expected_key] = $step; } } function getExpectedStep() { $step = $this->coalesce($this->container[$this->_step_expected_key], null); if ($this->stepExists($step)) return $step; return null; } /** * stepExists * * Check if the given step exists * * @param string $stepname The name of the step to check for * @return bool True if the step exists, false if not */ function stepExists($stepname) { return array_key_exists($stepname, $this->_steps); } /** * getStepName * * Get the name of the current step * * @return string The name of the current step */ function getStepName() { return $this->_currentStep; } /** * getStepNumber * * Gets the step number (from 1 to N where N is the number of steps * in the wizard) of the current step * * @param string $step Optional. The step to get the number for. If null then uses current step * @return int The number of the step. 0 if something went wrong */ function getStepNumber($step = null) { $steps = array_keys($this->_steps); $numSteps = count($steps); if (strlen($step) == 0) $step = $this->getStepName(); $ret = 0; for ($n = 1; $n <= $numSteps && $ret == 0; $n++) { if ($step == $steps[$n-1]) $ret = $n; } return $ret; } function stepCanBeProcessed($step) { $steps = array_keys($this->_steps); $numSteps = count($steps); for ($i = 0; $i < $numSteps; $i++) { $_step = $steps[$i]; if ($_step == $step) break; if (!$this->container[$this->_step_status_key][$_step]) return false; } return true; } /** * getStepProperty * * Retrieve a property for a given step. At this stage, the only * property steps have is a title property. * * @param string $key The key to get a property for * @param mixed $default The value to return if the key isn't found * @return mixed The property value or the default value */ function getStepProperty($key, $default = null) { $step = $this->getStepName(); if (isset($this->_steps[$step][$key])) return $this->_steps[$step][$key]; return $default; } /** * getFirstStep * * Get the step name of the first step * * @return string The name of the first step, or null if no steps */ function getFirstStep() { $steps = array_keys($this->_steps); return count($steps) > 0 ? $steps[0] : null; } function getFirstIncompleteStep() { $steps = array_keys($this->_steps); $numSteps = count($steps); for ($i = 0; $i < $numSteps; $i++) { $_step = $steps[$i]; if (!array_key_exists($this->_step_status_key, $this->container) || !$this->container[$this->_step_status_key][$_step]) return $_step; } return null; } /** * getPreviousStep * * Gets the step name of the previous step. If the current * step is the first step, then null is returned * * @return string The name of the previous step, or null */ function getPreviousStep($step) { $ret = null; $steps = array_keys($this->_steps); $done = false; foreach ($steps as $s) { if ($s == $step) { $done = true; break; } $ret = $s; } return $ret; } /** * getFollowingStep * * Get the step name of the next step. If the current * step is the last step, returns null * * @return string The name of the next step, or null */ function getFollowingStep($step) { $ret = null; $steps = array_keys($this->_steps); $ready = false; foreach ($steps as $s) { if ($s == $step) $ready = true; else if ($ready) { $ret = $s; break; } } return $ret; } /** * addStep * * Adds a step to the wizard * * @param string $stepname The name of the step * @param string $title The title of the current step */ function addStep($stepname, $title) { if (array_key_exists($stepname, $this->_steps)) { $this->addError('step', 'Step with name ' . $stepname . ' already exists'); return; } $this->_steps[$stepname] = array('title' => $title); if (!array_key_exists($this->_step_status_key, $this->container)) $this->container[$this->_step_status_key] = array(); if (!array_key_exists($stepname, $this->container[$this->_step_status_key])) $this->container[$this->_step_status_key][$stepname] = false; } /** * isFirstStep * * Check if the current step is the first step * * @return bool True if the current step is the first step */ function isFirstStep() { $steps = array_keys($this->_steps); return count($steps) > 0 && $steps[0] == $this->getStepName(); } /** * isLastStep * * Check if the current step is the last step * * @return bool True if the current step is the last step */ function isLastStep() { $steps = array_keys($this->_steps); return count($steps) > 0 && array_pop($steps) == $this->getStepName(); } /** * setValue * * Sets a value in the container * * @param string $key The key for the value to set * @param mixed $val The value */ function setValue($key, $val) { $this->container[$key] = $val; } /** * getValue * * Gets a value from the container * * @param string $key The key for the value to get * @param mixed $default The value to return if the key doesn't exist * @return mixed Either the key's value or the default value */ function getValue($key, $default = null) { return $this->coalesce($this->container[$key], $default); } /** * clearContainer * * Removes all data from the container. This is primarily used * to reset the wizard data completely */ function clearContainer() { foreach ($this->container as $k => $v) unset($this->container[$k]); } /** * coalesce * * Initializes a variable, by returning either the variable * or a default value * * @param mixed &$var The variable to fetch * @param mixed $default The value to return if variable doesn't exist or is null * @return mixed The variable value or the default value */ function coalesce(&$var, $default = null) { return isset($var) && !is_null($var) ? $var : $default; } /** * addError * * Add an error * * @param string $key An identifier for the error (e.g. the field name) * @param string $val An error message */ function addError($key, $val) { $this->_errors[$key] = $val; } /** * isError * * Check if an error has occurred * * @param string $key The field to check for error. If none specified checks for any error * @return bool True if an error has occurred, false if not */ function isError($key = null) { if (!is_null($key)) return array_key_exists($key, $this->_errors); return count($this->_errors) > 0; } function getError($key) { return array_key_exists($key, $this->_errors) ? $this->_errors[$key] : null; } } ?> Link to comment https://forums.phpfreaks.com/topic/141110-multy-step-application-form-help/ Share on other sites More sharing options...
gnarl Posted January 16, 2009 Author Share Posted January 16, 2009 CheckoutWizard.class.php <?php require_once('ZervWizard.class.php'); class CheckoutWizard extends ZervWizard { function CheckoutWizard() { // start the session and initialize the wizard session_start(); parent::ZervWizard($_SESSION, __CLASS__); // create the steps $this->addStep('personalinfo', 'Personal Information'); $this->addStep('charinfo', 'Character Information'); $this->addStep('raidexp', 'Raid Experience'); $this->addStep('compinfo', 'Computer Information'); $this->addStep('extrainfo', 'Extra Information'); $this->addStep('confirm', 'Confirm your details'); } // here we prepare the personal info step. function prepare_personalinfo() { $this->loadsex(); $this->loadeng(); } // now we process the first step. function process_personalinfo(&$form) { $name = $this->coalesce($form['name']); if (strlen($name) > 0) $this->setValue('name', $name); else $this->addError('name', '<img src="images/left.gif"> Your Name is recuired'); $location = $this->coalesce($form['location']); if (strlen($location) > 0) $this->setValue('location', $location); else $this->addError('location', '<img src="images/left.gif"> Your Location is recuired'); $sex = $this->coalesce($form['sex']); $this->loadsex(); if (array_key_exists($sex, $this->sex)) $this->setValue('sex', $sex); else $this->addError('sex', '<img src="images/left.gif"> Please select your Sex'); $age = $this->coalesce($form['age']); if (strlen($age) > 0) $this->setValue('age', $age); else $this->addError('age', '<img src="images/left.gif"> Please enter your Age'); $eng = $this->coalesce($form['eng']); $this->loadeng(); if (array_key_exists($eng, $this->eng)) $this->setValue('eng', $eng); else $this->addError('eng', '<img src="images/left.gif"> Please Rate your English'); return !$this->isError(); } // next step prepare function prepare_charinfo() { $this->loadrace(); $this->loadclass(); } // the proccess function process_charinfo(&$form) { $igname = $this->coalesce($form['igname']); if (strlen($igname) > 0) $this->setValue('igname', $igname); else $this->addError('igname', '<img src="images/left.gif"> Your Character Name is recuired'); $race = $this->coalesce($form['race']); $this->loadrace(); if (array_key_exists($race, $this->race)) $this->setValue('race', $race); else $this->addError('race', '<img src="images/left.gif"> Please select your Race'); $class = $this->coalesce($form['class']); $this->loadclass(); if (array_key_exists($class, $this->class)) $this->setValue('class', $class); else $this->addError('class', '<img src="images/left.gif"> Please select your Class'); $s1 = $this->coalesce($form['s1']); if (strlen($s1) > 0) $this->setValue('s1', $s1); else $this->addError('s1', '<img src="images/left.gif"> Please enter your Spec'); $s2 = $this->coalesce($form['s2']); if (strlen($s2) > 0) $this->setValue('s2', $s2); else $this->addError('s2', '<img src="images/left.gif"> Please enter your Spec'); $s3 = $this->coalesce($form['s3']); if (strlen($s3) > 0) $this->setValue('s3', $s3); else $this->addError('s3', '<img src="images/left.gif"> Please enter your Spec'); $days = $this->coalesce($form['days']); if (strlen($days) > 0) $this->setValue('days', $days); else $this->addError('days', '<img src="images/left.gif"> Please enter your Played Days'); $hours = $this->coalesce($form['hours']); if (strlen($hours) > 0) $this->setValue('hours', $hours); else $this->addError('hours', '<img src="images/left.gif"> Please enter your Played Hours'); $preguild = $this->coalesce($form['preguild']); if (strlen($preguild) > 0) $this->setValue('preguild', $preguild); else $this->addError('preguild', '<img src="images/left.gif"> Please enter your Previous Guilds (if you havent been in any type: None)'); $armory = $this->coalesce($form['armory']); if (strlen($armory) > 0) $this->setValue('armory', $armory); else $this->addError('armory', '<img src="images/left.gif"> Please enter your Armory Link'); $ui = $this->coalesce($form['ui']); if (strlen($ui) > 0) $this->setValue('ui', $ui); else $this->addError('ui', '<img src="images/left.gif"> Please enter your UI Link (you can Go to <a href="http://www.imageshack.us" target="_blank">Imageshack</a> or <a href="http://www.photobucket.com" target="_blank">Photobucket</a> to upload an image'); return !$this->isError(); } // next step prepare function prepare_raidexp() { $this->loadssc(); $this->loadmh(); $this->loadbt(); $this->loadswp(); $this->loadnaxx(); $this->loadmal(); $this->loadsar(); $this->loadvoa(); } // process function process_raidexp(&$form) { $ssc = $this->coalesce($form['ssc']); $this->loadssc(); if (array_key_exists($ssc, $this->ssc)) $this->setValue('ssc', $ssc); else $this->addError('ssc', '<img src="images/left.gif"> Please select your SSC Experience'); $mh = $this->coalesce($form['mh']); $this->loadmh(); if (array_key_exists($mh, $this->mh)) $this->setValue('mh', $mh); else $this->addError('mh', '<img src="images/left.gif"> Please select your MH Experience'); $bt = $this->coalesce($form['bt']); $this->loadbt(); if (array_key_exists($bt, $this->bt)) $this->setValue('bt', $bt); else $this->addError('bt', '<img src="images/left.gif"> Please select your BT Experience'); $swp = $this->coalesce($form['swp']); $this->loadswp(); if (array_key_exists($swp, $this->swp)) $this->setValue('swp', $swp); else $this->addError('swp', '<img src="images/left.gif"> Please select your SWP Experience'); $naxx = $this->coalesce($form['naxx']); $this->loadnaxx(); if (array_key_exists($naxx, $this->naxx)) $this->setValue('naxx', $naxx); else $this->addError('naxx', '<img src="images/left.gif"> Please select your Naxxramas Experience'); $mal = $this->coalesce($form['mal']); $this->loadmal(); if (array_key_exists($mal, $this->mal)) $this->setValue('mal', $mal); else $this->addError('mal', '<img src="images/left.gif"> Please select your Malygos • The Eye Of Eternity Experience'); $sar = $this->coalesce($form['sar']); $this->loadsar(); if (array_key_exists($sar, $this->sar)) $this->setValue('sar', $sar); else $this->addError('sar', '<img src="images/left.gif"> Please select your Sartharion • The Obsidian Sanctum Experience'); $voa = $this->coalesce($form['voa']); $this->loadvoa(); if (array_key_exists($voa, $this->voa)) $this->setValue('voa', $voa); else $this->addError('voa', '<img src="images/left.gif"> Please select your Wintergrasp • Vault Of Archavon Experience'); return !$this->isError(); } // next step prepare function prepare_compinfo() { $this->loados(); $this->loadvent(); $this->loadmic(); } // process function process_compinfo(&$form) { $os = $this->coalesce($form['os']); $this->loados(); if (array_key_exists($os, $this->os)) $this->setValue('os', $os); else $this->addError('os', '<img src="images/left.gif"> Please select your Operating System'); $vent = $this->coalesce($form['vent']); $this->loadvent(); if (array_key_exists($vent, $this->vent)) $this->setValue('vent', $vent); else $this->addError('vent', '<img src="images/left.gif"> Please select your Answer'); $mic = $this->coalesce($form['mic']); $this->loadmic(); if (array_key_exists($mic, $this->mic)) $this->setValue('mic', $mic); else $this->addError('mic', '<img src="images/left.gif"> Please select your Answer'); $isp = $this->coalesce($form['isp']); if (strlen($isp) > 0) $this->setValue('isp', $isp); else $this->addError('isp', '<img src="images/left.gif"> Type Your internet connection Speed'); $cpu = $this->coalesce($form['cpu']); if (strlen($cpu) > 0) $this->setValue('cpu', $cpu); else $this->addError('cpu', '<img src="images/left.gif"> Type your Prossecor Speed'); $ram = $this->coalesce($form['ram']); if (strlen($ram) > 0) $this->setValue('ram', $ram); else $this->addError('ram', '<img src="images/left.gif"> Type how mutch Ram you have'); return !$this->isError(); } // next step prepare function prepare_extrainfo() { } function process_extrainfo(&$form) { $guildf = $this->coalesce($form['guildf']); if (strlen($guildf) > 0) $this->setValue('guildf', $guildf); else $this->addError('guildf', '<img src="images/left.gif"> If you dont know anyone just Type: None'); $shout = $this->coalesce($form['shout']); if (strlen($shout) > 0) $this->setValue('shout', $shout); else $this->addError('shout', '<img src="images/left.gif"> Type anything you want /use brain = on!'); return !$this->isError(); } // the final step is the confirmation step. there's nothing to prepare here // as we're just asking for final acceptance from the user function process_confirm(&$form) { $confirm = (bool) $this->coalesce($form['confirm'], true); return $confirm; } /** * Miscellaneous utility functions */ function loadsex() { $this->sex = array('Male' => 'Male', 'Female' => 'Female'); } function loadeng() { $this->eng = array('1/10' => '1/10', '2/10' => '2/10', '3/10' => '3/10', '4/10' => '4/10', '5/10' => '5/10', '6/10' => '6/10', '7/10' => '7/10', '8/10' => '8/10', '9/10' => '9/10', 'English is my Middle Name!' => 'Excellent'); } function loadrace() { $this->race = array('Orc' => 'Orc', 'Tauren' => 'Tauren', 'Undead' => 'Undead', 'Troll' => 'Troll', 'Blood Elf' => 'Blood Elf'); } function loadclass() { $this->class = array('Death Knight' => 'Death Knight', 'Druid' => 'Druid', 'Hunter' => 'Hunter', 'Mage' => 'Mage', 'Paladin' => 'Paladin', 'Priest' => 'Priest', 'Rogue' => 'Rogue', 'Shaman' => 'Shaman', 'Warlock' => 'Warlock', 'Warrior' => 'Warrior'); } function loadssc() { $this->ssc = array('None' => 'None', '1/6' => '1/6', '2/6' => '2/6', '3/6' => '3/6', '4/6' => '4/6', '5/6' => '5/6', 'Full' => 'Full'); } function loadmh() { $this->mh = array('None' => 'None', '1/5' => '1/6', '2/5' => '2/6', '3/5' => '3/6', '4/5' => '4/6', 'Full' => 'Full'); } function loadbt() { $this->bt = array('None' => 'None', '1/9' => '1/6', '2/9' => '2/6', '3/9' => '3/6', '4/9' => '4/6', '5/9' => '5/6', '6/9' => '6/9', '7/9' => '7/9', '8/9' => '8/9', 'Full' => 'Full'); } function loadswp() { $this->swp = array('None' => 'None', '1/6' => '1/6', '2/6' => '2/6', '3/6' => '3/6', '4/6' => '4/6', '5/6' => '5/6', 'Full' => 'Full'); } function loados() { $this->os = array('Windows' => 'Windows', 'MacOs' => 'MacOS'); } function loadvent() { $this->vent = array('Yes' => 'Yes', 'No' => 'No'); } function loadmic() { $this->mic = array('No' => 'No', 'Yes' => 'Yes'); } function loadnaxx() { $this->naxx = array('None' => 'None', 'Only 10 Man' => '10man', 'Only 25 Man' => '25man', 'Full exp 10man and 25man' => 'Both'); } function loadmal() { $this->mal = array('None' => 'None', 'Only 10 Man' => '10man', 'Only 25 Man' => '25man', 'Full exp 10man and 25man' => 'Both'); } function loadsar() { $this->sar = array('None' => 'None', 'Only 10 Man' => '10man', 'Only 25 Man' => '25man', 'Full exp 10man and 25man' => 'Both'); } function loadvoa() { $this->voa = array('None' => 'None', 'Only 10 Man' => '10man', 'Only 25 Man' => '25man', 'Full exp 10man and 25man' => 'Both'); } } ?> Link to comment https://forums.phpfreaks.com/topic/141110-multy-step-application-form-help/#findComment-738567 Share on other sites More sharing options...
gnarl Posted January 16, 2009 Author Share Posted January 16, 2009 Application.php <?php require_once('CheckoutWizard.class.php'); $wizard = new CheckoutWizard(); $action = $wizard->coalesce($_GET['action']); $wizard->process($action, $_POST, $_SERVER['REQUEST_METHOD'] == 'POST'); // only processes the form if it was posted. this way, we // can allow people to refresh the page without resubmitting // form data ?> <html> <head> <title>Application</title> <!-- <link href="stylesheet.css" rel="stylesheet" type="text/css"> --> <style type="text/css"> <!-- #apply { visibility: hidden; } --> </style> </head> <body> <h1>Application</h1> <?php if ($wizard->isComplete()) { ?> <p> The form is now complete. Clicking the button below will clear the container and start again. </p> <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>?action=<?= $wizard->resetAction ?>"> <input type="submit" value="Start again" /> </form> <?php } else { ?> <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>?action=<?= $wizard->getStepName() ?>"> <h2><?= $wizard->getStepProperty('title') ?></h2> <?php if ($wizard->getStepName() == 'personalinfo') { ?> <table> <tr> <td width="79"><b>Real Name</b>:</td> <td width="90"> <input name="name" type="text" value="<?= htmlSpecialChars($wizard->getValue('name')) ?>" size="15" maxlength="15" /> </td> <td width="20"> </td> <td> <?php if ($wizard->isError('name')) { ?> <?= $wizard->getError('name') ?> <?php } ?> </td> </tr> <tr> <td><b>Location:</b></td> <td> <input name="location" type="text" value="<?= htmlSpecialChars($wizard->getValue('location')) ?>" size="15" maxlength="15" /> </td> <td> </td> <td> <?php if ($wizard->isError('location')) { ?> <?= $wizard->getError('location') ?> <?php } ?> </td> </tr> <tr> <td><b>Sex:</b></td> <td> <select name="sex"> <option value=""></option> <?php foreach ($wizard->sex as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('sex') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select> </td> <td> </td> <td> <?php if ($wizard->isError('sex')) { ?> <?= $wizard->getError('sex') ?> <?php } ?> </td> </tr> <tr> <td><b>Age:</b></td> <td><input name="age" type="text" value="<?= htmlSpecialChars($wizard->getValue('age')) ?>" size="2" maxlength="2" /></td> <td> </td> <td><?php if ($wizard->isError('age')) { ?> <?= $wizard->getError('age') ?> <?php } ?></td> </tr> </table> <p> </p> <table> <tr> <td width="127"><b>Rate Your English:</b></td> <td width="41"><select name="eng"> <option value=""></option> <?php foreach ($wizard->eng as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('eng') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td width="20"> </td> <td><?php if ($wizard->isError('eng')) { ?> <?= $wizard->getError('eng') ?> <?php } ?></td> </tr> </table> <?php } else if ($wizard->getStepName() == 'charinfo') { ?> <table> <tr> <td width="116"><strong>Character Name:</strong></td> <td width="90"><input name="igname" type="text" value="<?= htmlSpecialChars($wizard->getValue('igname')) ?>" size="15" maxlength="15" /></td> <td width="20"> </td> <td> <?php if ($wizard->isError('igname')) { ?> <?= $wizard->getError('igname') ?> <?php } ?> </td> </tr> <tr> <td><strong>Race:</strong></td> <td><select name="race"> <option value=""></option> <?php foreach ($wizard->race as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('race') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td> </td> <td> <?php if ($wizard->isError('race')) { ?> <?= $wizard->getError('race') ?> <?php } ?> </td> </tr> <tr> <td><strong>Class::</strong></td> <td><select name="class"> <option value=""></option> <?php foreach ($wizard->class as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('class') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td> </td> <td> <?php if ($wizard->isError('class')) { ?> <?= $wizard->getError('class') ?> <?php } ?> </td> </tr> <tr> <td><strong>Spec:</strong></td> <td><input name="s1" type="text" value="<?= htmlSpecialChars($wizard->getValue('s1')) ?>" size="2" maxlength="2" /> • <input name="s2" type="text" value="<?= htmlSpecialChars($wizard->getValue('s2')) ?>" size="2" maxlength="2" /> • <input name="s3" type="text" value="<?= htmlSpecialChars($wizard->getValue('s3')) ?>" size="2" maxlength="2" /></td> <td> </td> <td> <?php if ($wizard->isError('s1')) { ?> <?= $wizard->getError('s1') ?> <?php } ?></td> </tr> </table> <p> </p> <p> </p> <p> </p> <table> <tr> <td width="480"><div align="center"><b>Played Time</b></div></td> <td width="20"> </td> <td> </td> </tr> <tr> <td><div align="center"> <input name="days" type="text" value="<?= htmlSpecialChars($wizard->getValue('days')) ?>" size="2" maxlength="3" /> <b>Days •</b> <input name="hours" type="text" value="<?= htmlSpecialChars($wizard->getValue('hours')) ?>" size="2" maxlength="3" /> <b>Hours</b></div></td> <td> </td> <td> <?php if ($wizard->isError('days')) { ?> <?= $wizard->getError('days') ?> <?php } ?></td> </tr> <tr> <td><hr></td> <td> </td> <td> </td> </tr> <tr> <td><div align="center"><b>Previous Guilds</b></div></td> <td> </td> <td> </td> </tr> <tr> <td><input name="preguild" type="text" id="preguild" value="<?= htmlSpecialChars($wizard->getValue('preguild')) ?>" size="80" maxlength="100" /></td> <td> </td> <td> <?php if ($wizard->isError('preguild')) { ?> <?= $wizard->getError('preguild') ?> <?php } ?></td> </tr> <tr> <td><hr></td> <td> </td> <td> </td> </tr> <tr> <td><div align="center"><b>Armory Link (<a href="http: u.wowarmory.com" target="_blank">WoW Armory</a>)</b></div></td> <td> </td> <td> </td> </tr> <tr> <td><input name="armory" type="text" value="<?= htmlSpecialChars($wizard->getValue('armory')) ?>" size="80" maxlength="100" /></td> <td> </td> <td> <?php if ($wizard->isError('armory')) { ?> <?= $wizard->getError('armory') ?> <?php } ?></td> </tr> <tr> <td><hr></td> <td> </td> <td> </td> </tr> <tr> <td><div align="center"><b>User Interface (UI) ScreenShot</b></div></td> <td> </td> <td> </td> </tr> <tr> <td><input name="ui" type="text" value="<?= htmlSpecialChars($wizard->getValue('ui')) ?>" size="80" maxlength="100" /></td> <td> </td> <td> <?php if ($wizard->isError('ui')) { ?> <?= $wizard->getError('ui') ?> <?php } ?></td> </tr> <tr> <td><hr></td> <td> </td> <td> </td> </tr> </table> <?php } else if ($wizard->getStepName() == 'raidexp') { ?> <table> <tr> <td width="41"><select name="ssc"> <option value=""></option> <?php foreach ($wizard->ssc as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('ssc') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td width="191"><b>SerpentShrine Cavern (SSC)</b></td> <td width="20"> </td> <td> <?php if ($wizard->isError('ssc')) { ?> <?= $wizard->getError('ssc') ?> <?php } ?> </td> </tr> <tr> <td><select name="mh"> <option value=""></option> <?php foreach ($wizard->mh as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('mh') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td><b>Hyjal Summit (MH)</b></td> <td> </td> <td> <?php if ($wizard->isError('mh')) { ?> <?= $wizard->getError('mh') ?> <?php } ?> </td> </tr> <tr> <td><select name="bt"> <option value=""></option> <?php foreach ($wizard->bt as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('bt') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td><b>Black Temple (BT)</b></td> <td> </td> <td> <?php if ($wizard->isError('bt')) { ?> <?= $wizard->getError('bt') ?> <?php } ?> </td> </tr> <tr> <td><select name="swp"> <option value=""></option> <?php foreach ($wizard->swp as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('swp') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td><b>SunWell Plateau (SWP)</b></td> <td> </td> <td> <?php if ($wizard->isError('swp')) { ?> <?= $wizard->getError('swp') ?> <?php } ?></td> </tr> </table> <p> </p> <table> <tr> <td width="41"><select name="naxx" id="naxx"> <option value=""></option> <?php foreach ($wizard->naxx as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('naxx') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td width="234"><b>Naxxramas</b></td> <td width="20"> </td> <td><?php if ($wizard->isError('naxx')) { ?> <?= $wizard->getError('naxx') ?> <?php } ?></td> </tr> <tr> <td><select name="mal" id="mal"> <option value=""></option> <?php foreach ($wizard->mal as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('mal') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td><b>Malygos • The Eye Of Eternity</b></td> <td> </td> <td><?php if ($wizard->isError('mal')) { ?> <?= $wizard->getError('mal') ?> <?php } ?></td> </tr> <tr> <td><select name="sar" id="sar"> <option value=""></option> <?php foreach ($wizard->sar as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('sar') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td><b>Sartharion • The Obsidian Sanctum</b></td> <td> </td> <td><?php if ($wizard->isError('sar')) { ?> <?= $wizard->getError('sar') ?> <?php } ?></td> </tr> <tr> <td><select name="voa" id="voa"> <option value=""></option> <?php foreach ($wizard->voa as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('voa') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td><b>Wintergrasp • Vault Of Archavon</b></td> <td> </td> <td><?php if ($wizard->isError('voa')) { ?> <?= $wizard->getError('voa') ?> <?php } ?></td> </tr> </table> <?php } else if ($wizard->getStepName() == 'compinfo') { ?> <table> <tr> <td width="86"><b>System:</b></td> <td width="61"><select name="os" id="os"> <option value="" selected></option> <?php foreach ($wizard->os as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('os') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td width="20"> </td> <td> <?php if ($wizard->isError('os')) { ?> <?= $wizard->getError('os') ?> <?php } ?> </td> </tr> <tr> <td><b>Ventrilo:</b></td> <td><select name="vent" id="vent"> <option value=""></option> <?php foreach ($wizard->vent as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('vent') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select></td> <td> </td> <td> <?php if ($wizard->isError('vent')) { ?> <?= $wizard->getError('vent') ?> <?php } ?> </td> </tr> <tr> <td><b>Microphone:</b></td> <td> <select name="mic" id="mic"> <option value=""></option> <?php foreach ($wizard->mic as $k => $v) { ?> <option value="<?= $k ?>"<?php if ($wizard->getValue('mic') == $k) { ?> selected="selected"<?php } ?>> <?= $v ?> </option> <?php } ?> </select> </td> <td> </td> <td> <?php if ($wizard->isError('mic')) { ?> <?= $wizard->getError('mic') ?> <?php } ?> </td> </tr> <tr> <td><b>Internet:</b></td> <td><input name="isp" type="text" id="isp" value="<?= htmlSpecialChars($wizard->getValue('isp')) ?>" size="4" maxlength="4" /> <b>Mbit</b></td> <td> </td> <td><?php if ($wizard->isError('isp')) { ?> <?= $wizard->getError('isp') ?> <?php } ?></td> </tr> <tr> <td><b>Prossecor:</b></td> <td><input name="cpu" type="text" id="cpu" value="<?= htmlSpecialChars($wizard->getValue('cpu')) ?>" size="4" maxlength="4" /> <b>Mhz</b></td> <td> </td> <td><?php if ($wizard->isError('cpu')) { ?> <?= $wizard->getError('cpu') ?> <?php } ?></td> </tr> <tr> <td><b>Ram:</b></td> <td><input name="ram" type="text" id="ram" value="<?= htmlSpecialChars($wizard->getValue('ram')) ?>" size="4" maxlength="4" /> <b>MB</b></td> <td> </td> <td><?php if ($wizard->isError('ram')) { ?> <?= $wizard->getError('ram') ?> <?php } ?></td> </tr> </table> <?php } else if ($wizard->getStepName() == 'extrainfo') { ?> <table> <tr> <td width="317"><b>Do you know anyone in our Guild ?</b></td> <td width="20"> </td> <td> </td> </tr> <tr> <td><input name="guildf" type="text" id="guildf" value="<?= htmlSpecialChars($wizard->getValue('guildf')) ?>" size="50" maxlength="50" /></td> <td> </td> <td><?php if ($wizard->isError('guildf')) { ?> <?= $wizard->getError('guildf') ?> <?php } ?></td> </tr> <tr> <td><b>Any Last Shout ?</b></td> <td></td> <td> </td> </tr> <tr> <td><textarea name="shout" cols="50" rows="4" id="shout"><?= htmlSpecialChars($wizard->getValue('shout')) ?></textarea></td> <td> </td> <td> <?php if ($wizard->isError('shout')) { ?> <?= $wizard->getError('shout') ?> <?php } ?></td> </tr> </table> <?php } else if ($wizard->getStepName() == 'confirm') { ?> <p> <b>Please verify the entered Information and then click Finish to complete your Application.</b></p> <table> <tr> <td width="156"><b>Real Name:</b></td> <td><?= $wizard->getValue('name') ?></td> </tr> <tr> <td><b>Location:</b></td> <td><?= $wizard->getValue('location') ?></td> </tr> <tr> <td><b>Sex:</b></td> <td><?= $wizard->getValue('sex') ?></td> </tr> <tr> <td><b>Age:</b></td> <td><?= $wizard->getValue('age') ?></td> </tr> <tr> <td><b>English:</b></td> <td><?= $wizard->getValue('eng') ?></td> </tr> <tr> <td><b>Character Name:</b></td> <td><?= $wizard->getValue('igname') ?></td> </tr> <tr> <td><b>Race:</b></td> <td><?= $wizard->getValue('race') ?></td> </tr> <tr> <td><b>Class:</b></td> <td><?= $wizard->getValue('class') ?></td> </tr> <tr> <td><b>Spec:</b></td> <td><?= $wizard->getValue('s1') ?> <b>/</b> <?= $wizard->getValue('s2') ?> <b>/</b><?= $wizard->getValue('s3') ?></td> </tr> <tr> <td><b>Played:</b></td> <td><?= $wizard->getValue('days') ?> - <?= $wizard->getValue('hours') ?></td> </tr> <tr> <td><b>Previous Guilds:</b></td> <td><?= $wizard->getValue('preguild') ?></td> </tr> <tr> <td><b>Armory Link:</b></td> <td><?= $wizard->getValue('armory') ?></td> </tr> <tr> <td><b>UI ScreenShot:</b></td> <td><?= $wizard->getValue('ui') ?></td> </tr> <tr> <td><b>SSC:</b></td> <td><?= $wizard->getValue('ssc') ?></td> </tr> <tr> <td><b>MH:</b></td> <td><?= $wizard->getValue('mh') ?></td> </tr> <tr> <td><b>BT:</b></td> <td><?= $wizard->getValue('bt') ?></td> </tr> <tr> <td><b>SWP:</b></td> <td><?= $wizard->getValue('swp') ?></td> </tr> <tr> <td><b>Naxxramas:</b></td> <td><?= $wizard->getValue('naxx') ?></td> </tr> <tr> <td><b>Malygos:</b></td> <td><?= $wizard->getValue('mal') ?></td> </tr> <tr> <td><b>Sartharion:</b></td> <td><?= $wizard->getValue('sar') ?></td> </tr> <tr> <td><b>Wintergrasp:</b></td> <td><?= $wizard->getValue('voa') ?></td> </tr> <tr> <td><b>Operating System:</b></td> <td><?= $wizard->getValue('os') ?></td> </tr> <tr> <td><b>Prossecor:</b></td> <td><?= $wizard->getValue('cpu') ?></td> </tr> <tr> <td><b>Ram:</b></td> <td><?= $wizard->getValue('ram') ?></td> </tr> <tr> <td><b>Internet Connection:</b></td> <td><?= $wizard->getValue('isp') ?></td> </tr> <tr> <td><b>Ventrilo:</b></td> <td><?= $wizard->getValue('vent') ?></td> </tr> <tr> <td><b>Microphone:</b></td> <td><?= $wizard->getValue('mic') ?></td> </tr> <tr> <td><b>Know Anyone In Guild:</b></td> <td><?= $wizard->getValue('guildf') ?></td> </tr> <tr> <td><b>Any Last Shout:</b></td> <td><?= $wizard->getValue('shout') ?></td> </tr> </table> <?php } ?> <p> <input type="submit" name="previous" value="<< Previous"<?php if ($wizard->isFirstStep()) { ?> disabled="disabled"<?php } ?> /> <input type="submit" value="<?= $wizard->isLastStep() ? 'Finish' : 'Next' ?> >>" /> </p> </form> <?php } ?> </body> </html> I am so sorry for my triple post but the code didnt fit in 1 post Link to comment https://forums.phpfreaks.com/topic/141110-multy-step-application-form-help/#findComment-738569 Share on other sites More sharing options...
gnarl Posted January 19, 2009 Author Share Posted January 19, 2009 no one can help me ? i am trying to find a way to make the data the user entered in the form to get posted in my phpbb3 forum Link to comment https://forums.phpfreaks.com/topic/141110-multy-step-application-form-help/#findComment-740392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.