<?php
require_once ('HTML/QuickForm.php');
$form = new HTML_QuickForm();
// the function checks whether the passwords are the same
function cmpPass($fields)
{
if (strlen($fields['passwd1']) && strlen($fields['passwd2']) &&
$fields['passwd1'] != $fields['passwd2']) {
return array('passwd1' => 'Passwords are not the same');
}
return true;
}
$form->addElement('password', 'passwd1', 'Enter password');
$form->addElement('password', 'passwd2', 'Confirm password');
$form->addFormRule('cmpPass');
?> |