Form example
Warning: array_merge(): Argument #1 is not an array in /usr/websites/web01499/www.delfs.dk/projects/Form/Form.php on line 217
Warning: Invalid argument supplied for foreach() in /usr/websites/web01499/www.delfs.dk/projects/Form/Form.php on line 222
<html>
<head>
<title>Form example</title>
</head>
<body>
<h1>Form example</h1>
<?php
include "Form.php";
$elements = array();
$elements[] = array('label'=>'First name', 'type'=>'text', 'name'=>'firstname', 'validate'=>'letters');
$elements[] = array('label'=>'Last name', 'type'=>'text', 'name'=>'lastname', 'validate'=>'letters');
$elements[] = array('label'=>'Adress', 'type'=>'text', 'name'=>'adress', 'validate'=>'/[a-z]+ [0-9]+/i', 'errmsg'=>'Field must be as <streetname number>');
$elements[] = array('label'=>'Zipcode', 'type'=>'text', 'name'=>'zip', 'validate'=>'number');
$elements[] = array('label'=>'Email', 'type'=>'text', 'name'=>'email', 'validate'=>'email');
$elements[] = array('label'=>'Password', 'type'=>'password', 'name'=>'passwd', 'validate'=>'word');
$elements[] = array('label'=>'Passwd. again', 'type'=>'password', 'name'=>'passwd2', 'validate'=>'passwd');
$elements[] = array('type'=>'submit', 'value'=>'Post!');
$frm = new Form(array('method' => 'GET', 'action'=>basename(__FILE__)), 2, NULL, $elements);
if ($frm->validate()) {
echo "Juhuu";
} else {
echo $frm->getJs();
$frm->display();
}
echo "<br/><br/>\n";
show_source(__FILE__);
?>
</body>
</html>