Location: PHPKode > scripts > Form Maker and Processor > form-maker-and-processor/sampleCreate.php
<?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();

?>
Return current item: Form Maker and Processor