PHP Code:
// Add a header to the form
$form->addElement('header', 'header', 'Registration Form');
// Register the compare function
$form->registerRule('compare', 'function', 'cmpPass');
// The login field
$form->addElement('text','login','Desired Username:','class="signupData"');
$form->addRule('login','Please provide a username','required',false,'client');
$form->addRule('login','Username must be at least 6 characters','minlength',6,'client');
$form->addRule('login','Username cannot be more than 50 characters','maxlength',50,'client');
$form->addRule('login','Username can only contain letters and numbers','alphanumeric',NULL,'client');
// The password field
$form->addElement('password','password','Password:','class="signupData"');
$form->addRule('password','Please provide a password','required',false,'client');
$form->addRule('password','Password must be at least 6 characters','minlength',6,'client');
$form->addRule('password','Password cannot be more than 12 characters','maxlength',50,'client');
$form->addRule('password','Password can only contain letters and numbers','alphanumeric',NULL,'client');
// The field for confirming the password
$form->addElement('password','confirmPass','Confirm:','class="signupData"');
$form->addRule('confirmPass','Please confirm password','required',false,'client');
$form->addRule('confirmPass','Passwords must match','compare','function');
// The email field
$form->addElement('text','email','Email Address:','class="signupData"');
$form->addRule('email','Please an email address','required',false,'client');
$form->addRule('email','Please enter a valid email address','email',false,'client');
$form->addRule('email','Email cannot be more than 50 characters','maxlength',50,'client');
// The first name field
$form->addElement('text','firstName','First Name:','class="signupData"');
$form->addRule('firstName','Please enter your first name','required',false,'client');
$form->addRule('firstName','First name cannot be more than 50 characters','maxlength',50,'client');
// The last name field
$form->addElement('text','lastName','Last Name:','class="signupData"');
$form->addRule('lastName','Please enter your last name','required',false,'client');
$form->addRule('lastName','Last name cannot be more than 50 characters','maxlength',50,'client');
// The signature field
$form->addElement('textarea','signature','Signature:','class="signature"');
[B]// The Recruiter field
$form->addElement('select','recruiter','Recruited by:');[/B]
// Add a submit button called submit and "Send" as the text for the button
$form->addElement('submit','submit','Register','class="createAccount"');
// Specify the "required field" note for the bottom of the form
$form->setRequiredNote('<span class="required">*</span> required');
// If the form is submitted...
if ( $form->validate() ) {
// Apply the encryption filter to the password
$form->applyFilter('password', 'encryptValue');
// Build an array from the submitted form values
$submitVars=array (
'login'=>$form->getSubmitValue('login'),
'password'=>$form->getSubmitValue('password'),
'email'=>$form->getSubmitValue('email'),
'firstName'=>$form->getSubmitValue('firstName'),
'lastName'=>$form->getSubmitValue('lastName'),
'signature'=>$form->getSubmitValue('signature') );
// Create signup
if ( $signUp->createSignup($submitVars) ) {
// Send confirmation email
if ( $signUp->sendConfirmation() ) {
$display='Thank you. Please check your email to '.
'confirm your account';
} else {
$display='Unable to send confirmation email.<br />'.
'Please contact the site administrators';
}
} else {
$display='There was an error creating your account.<br />'.
'Please try again later or '.
'contact the site administrators';
}
} else {
// If not submitted, display the form
$display=$form->toHtml();
}
}
The part in bold is the part that i will need to display stuff from a database and display it in a drop down box.
Bookmarks