代码如下: <?php // signup.php // demonstrates a simple multipage form using xajax // and the xajax.getFormValues() function. // using xajax version 0.1 beta4 // http://xajax.sourceforge.net session_start(); include ("xajax.inc.php"); function processForm($aFormValues) { if (array_key_exists("username",$aFormValues)) { return processAccountData($aFormValues); } else if (array_key_exists("firstName",$aFormValues)) { return processPersonalData($aFormValues); } } function processAccountData($aFormValues) { $objResponse = new xajaxResponse(); $bError = false; if (trim($aFormValues['username']) == "") { $objResponse->addAlert("Please enter a username."); $bError = true; } if (trim($aFormValues['newPass1']) == "") { $objResponse->addAlert("You may not have a blank password."); $bError = true; } if ($aFormValues['newPass1'] != $aFormValues['newPass2']) { $objResponse->addAlert("Passwords do not match. Try again."); $bError = true; } if (!$bError) { $_SESSION = array(); $_SESSION['newaccount']['username'] = trim($aFormValues['username']); $_SESSION['newaccount']['password'] = trim($aFormValues['newPass1']);