PHP:Form Demo 4

Exactly the same as the previous demo, EXCEPT this time we use an external formtype file. Click here to view the formtype file.






Source:

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

    <body>
        <h1>PHP:Form Demo 4</h1>
        <p>Exactly the same as the previous demo, EXCEPT this time we use an external formtype file. <a href="fieldtypes.xml">Click here to view the formtype file</a>.</p>


        <php:form name="demo1">
            <formtype src="<?php echo dirname(__FILE__); ?>/fieldtypes.xml" />

            <formfield type="text" id="field1" name="field1" label="Field 1: " />
            <formfield type="text" id="field2" name="field2" label="Field 2: " />
            <formfield type="text" id="field3" name="field3" label="Field 3: " />
            <formfield type="text" id="field4" name="field4" label="Field 4: " value="this has a default value" />
            <formfield type="text" id="field5" name="field5" label="Field 5: " />    

            <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>