|
Posted by Meiao on 10/18/05 14:32
I'd take a look at PEAR's QuickForm
it would be something like this:
<?php
require_once('HTML/QuickForm.php');
$form = new HTML_QuickForm('emailform', 'POST');
$form->addElement('text', 'email', 'Whats your email?');
$form->addRule('email', 'Please, type your email', 'required');
//not completely sure about this one
$form->addRule('email', 'Please, type your REAL email', 'regex',
'/[^@]+@.*/');
if($form->validate()){
$form->freeze();
$form->process('processf', false);
}
else{
$form->display();
}
?>
You must also provide de processf function;
function processf($values){
//this will show you the form values
print_r($values);
}
Navigation:
[Reply to this message]
|