PHP Classes

File: Form.php

Recommend this page to a friend!
  Classes of none   Simple PHP Form Builder Class   Form.php   Download  
File: Form.php
Role: Example script
Content type: text/plain
Description: Form Example
Class: Simple PHP Form Builder Class
Generate HTML for Web forms
Author: By
Last change:
Date: 11 years ago
Size: 1,473 bytes
 

Contents

Class file image Download
<?php
require_once 'PHPInterfaceTags.php';
require_once
'PHPClassForm.php';
require_once
'PHPClassFormInputTypes.php';

$form = new PHPClassForm();
$input = new PHPClassFormInput();
$select = new PHPClassFormSelect();
$readonly = new PHPClassFormReadOnly();
$textarea = new PHPClassFormTextarea();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="form.css" />

<title>Form example</title>
</head>
<body>
<div id="container">
<h1>Form Example</h1>
<div id="data">
<?php
$arr
= array("From 10 to 20", "From 30 to 40", "From 40 to 50");
$form->openForm('testForm', $_SERVER['PHP_SELF'], 'POST');
if (!isset(
$_POST['age'])){
   
$input->tagItem('text', 'name', '', 'Your name', 'b');
    print
"<br /><br />";
   
$select->tagItem('age', $arr, '------', 'Select your age range', 'b');
    print
"<br /><br />";
   
$textarea->tagItem('comment', '', 'Write your comment', 'b');
    print
"<br /><br />";
   
$form->closeForm();
    print
"<br /><br />";
} else {
   
$readonly->tagItem('','name', $_POST['name'], 'Your name is: ', 'b');
    print
"<br /><br />";
   
$readonly->tagItem('','age', $_POST['age'], 'Your age is: ');
    print
"<br /><br />";
   
$readonly->tagItem('','comment', $_POST['comment'], 'Your comment is: ');
    print
"<br /><br />";
   
$form->closeForm('no_submit');
    print
"<br /><br />";
}
?>
</div>
</div>
</body>
</html>