PHP Classes
elePHPant
Icontem

File: test_form.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Sean Meese  >  StrudleForm  >  test_form.php  >  Download  
File: test_form.php
Role: Example script
Content type: text/plain
Description: Examples of all functiuons available in the class file
Class: StrudleForm
Form Generation Class
Author: By
Last change:
Date: 13 years ago
Size: 2,184 bytes
 

Contents

Class file image Download
<?php
   
   
// include file
   
include 'StrudleForm.php';
   
$FormX = new FormX;

   
// Turn on CSS support
   
$FormX->css = 'ON';

?>



<html>
<head><title>Example of how to use StrudleForm</title>
<style type='text/css'>
<!--
body{
    font-family: verdana;
    font-size: 10px;
}
-->
</style>
</head>
<body>


<?php

// beginning of form
echo $FormX->startForm('index2.php');

//draw text boxes
echo $FormX->drawText('first','First Name')."<br />";
echo
$FormX->drawText('last', 'Last Name')."<br /><br />";

// Let's go grey
$FormX->background_color = '#CCCCCC';

echo
$FormX->drawText('address1','Address 1')."<br />";
echo
$FormX->drawText('address2','Address 2')."<br /><br />";

// Let's go black, and big!
$FormX->background_color = '#000000';
$FormX->color = '#FFFFFF';
$FormX->size = 80;

echo
$FormX->drawText('city','City')."<br />";
echo
$FormX->drawText('state','State')."<br />";
echo
$FormX->drawText('zip','Zip Code')."<br /><br />";

// Let's go back to default
$FormX->setDefaults();

//draw password box
echo "Your password:<br />";
echo
$FormX->drawPassword('user_password')."<br /><br />";

//here's some radio buttons
echo "Male ".$FormX->drawRadio('sex','male', 'checked');
echo
"Female ".$FormX->drawRadio('sex','female')."<br /><br />";

//and a checkbox for good measure
echo "Would you like to be on my mailing list? ".$FormX->drawCheck('mailing_list','yes', 'checked')."<br /><br />";

//I changed my mind, I want everything to be grey!
$FormX->background_color = "#CCCCCC";

//here's a file upload form. make sure enctype is appropriate
echo "Upload your picture<br />";
echo
$FormX->drawFile('pic')."<br /><br />";

//the textarea form element, with different sizes
//but I want to change the background and text color first
$FormX->color = 'blue';
$FormX->background_color = 'red';
$FormX->rows = 5;
$FormX->cols = 50;

echo
"Anything else you'd like to add?<br />";
echo
$FormX->drawTextArea('comments')."<br />";

//and finally, the submit and reset buttons

echo $FormX->drawSubmit('Click to Submit');
echo
$FormX->drawReset('Click to Reset');

?>



</body>
</html>