Login   Register  
PHP Classes
elePHPant
Icontem

File: sampleCreate.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of azizny  >  Form Maker and Processor  >  sampleCreate.php  >  Download  
File: sampleCreate.php
Role: Example script
Content type: text/plain
Description: Form Maker Implementation
Class: Form Maker and Processor
Generate and process contact forms
Author: By
Last change:
Date: 2008-09-22 21:56
Size: 3,555 bytes
 

Contents

Class file image Download
<?php
/**************************************************/
/*
Released by AwesomePHP.com, under the GPL License, a
copy of it should be attached to the zip file, or
you can view it on http://AwesomePHP.com/gpl.txt
*/
/**************************************************/

/*
Sample Implementation of Form Creation
--------------------------------------
*/

require('formMaker.class.php');
// Create a new form
$myform = new createForm;

// Form parameters
$myform->doCreate('contactus','_self','post','sampleProcess.php');

// Messages (displayed on two colspan)
$myform->createAlert($message);

// TextBox (field label, html code name, default value, extra paramters)
$myform->createTextBox('Username:','user_name',$_POST['user_name']);
$myform->createTextBox('EMail:','friend_email',$_POST['friend_email']);

// File Upload (field label, html code name, default value, extra paramters)
$myform->createFileUpload('File:','file',$_FILES['file']['name']);

// Text Area (field label, html code name, default value, extra paramters)
$myform->createTextArea('Comment:','comment','teeteet',$_POST['comment']);

// Start Group for CheckBoxes (field label)
$myform->startGroup();
// CheckBox (field label, html code name, default value, preset, ischecked, extra paramters)
$myform->createCheckBox('Call me','docall','yes',$_POST['docall'],false);
$myform->createCheckBox('Call me 2','docall2','yes',$_POST['docall2'],false);
$myform->createCheckBox('Call me 3','docall3','yes',$_POST['docall3'],true);
// End Group for CheckBoxes
$myform->endGroup();

// Start Group for RadioButtons (field label)
$myform->startGroup('Please select your color:');
// RadioButton (field label, html code name, default value, preset, ischecked, extra paramters)
$myform->createRadioButton('Red','color','red',$_POST['color'],false);
$myform->createRadioButton('Blue','color','blue',$_POST['color'],false);
$myform->createRadioButton('Yellow','color','yellow',$_POST['color'],false);
// End Group for RadioButtons
$myform->endGroup();

// Start List Menu (field label, html code name, extra paramters)
$myform->startListMenu('Select City:','cityname');
// List options (field label, html code name, preset, extra paramters)
$myform->addOption('NYC','ny',$_POST['cityname']);
$myform->addOption('Detroit','DT',$_POST['cityname']);
// End List Menu
$myform->endList();

// List Menu List (field label, html code name, height, allow multiple selections, extra paramters)
$myform->startListList('Select City:','cityname2[]',2,true);
// List options (field label, html code name, preset, extra paramters)
$myform->addOption('NYC','ny',$_POST['cityname2'][0]);
$myform->addOption('Detroit','DT',$_POST['cityname2'][1]);
// End List Menu List
$myform->endList();

// Input Image (field name, html code name, src location, extra paramters)
$myform->addImageInput('Logo: ''myimage''http://www.goldland.us/images/everything_gold_01.gif',' onClick="alert(\'LALA\');"');
// Add Hidden Field (html code name, value, extra paramters)
$myform->addHiddenInput('hidden_field','hiddenvalue');

// Add Submit Button (field label, value, extra paramters)
$myform->makeSubmit('Submit','SUBMIT');
// Add Reset Button (field label, value, extra paramters)
$myform->makeReset('Reset','RESET');
// Add Button (field label, value, extra paramters)
$myform->MakeButton('Click Here','notimportant',' onClick="alert(\'HAHA\');"');

// Finalize form
$myform->finalizeForm();
// Display final form
$myform->printForm();

?>