PHP:Form Demo 1

Just a simple form, with two text fields and a textarea. Of course, each field is validated as well.

Name:
E-mail:

Comments:


Source:

<?php
include ('../../libs/phpform.php');
?>
<html>
    <head><title>PHP:Form Demo 1</title></head>

    <body>
        <h1>PHP:Form Demo 1</h1>
        <p>Just a simple form, with two text fields and a textarea. Of course, each field is validated as well.</p>

        <php:form name="demo1">
            Name: <input type="text" name="name" />
            <validator for="name" required="true">Please enter your name</validator><br />

            E-mail: <input type="text" name="email" />
            <validator for="email" required="true">Please enter your e-mail address</validator><br /><br />

            Comments:<br /> <textarea name="comments"></textarea>
            <validator for="comments" required="true">Please enter some comments</validator><br /><br />

            <input type="submit" name="submit" value="Submit Form" />
        </php:form>

        <?php
            
// Does the form validate?
            
if (!$_FORMS->validate('demo1')) {
                
// Display form
                
$_FORMS->display('demo1');
            } else {
                
// Print POST variables
                
echo '<pre>';
                
print_r ($_POST);
                echo 
'</pre>';
            }

            
// Show source (only for demo purposes)
            
echo '<h2>Source: </h2>';
            
highlight_file (__FILE__);
        
?>

    </body>
</html>