<?php
include_once 'link.class.php';
$link = new dyna_links;
include_once 'form.class.php';
$form = new dyna_form;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Dynamic Form Class</title>
<style type="text/css">
body {
font-size: 11px;
font-family: verdana;
color: #000000;
}
td, select, input, textarea, label {
font-size: 11px;
font-family: verdana;
color: #000000;
font-weight: normal;
text-align: left;
}
fieldset {
padding: 5px;
font-size: 13pt;
color: #008800;
font-weight: bold;
width: 200px;
}
.sub2 {
padding: 5px;
font-size: 12px;
color: #0000ff;
width: 300px;
}
.input {
color: #ffffff;
background: #006699;
}
h1 {
font-family: verdana,helvetica,arial,sans-serif;
font-size: 16pt;
font-weight: bold;
}
h2 {
font-family: verdana,helvetica,arial,sans-serif;
font-size: 13pt;
font-weight: bold;
}
code {
font-family: Courier New,serif;
font-size: 12px;
font-weight: normal;
}
</style>
</head>
<body>
<?php echo $form->action('form.php#top','post','_empty'); ?>
<h1>Dynamic Form Class</h1>
<div align="justify">Dynamic Form Class is a PHP class to create form objects for any webpage or intranet application.</div><br>
<hr>
<h2>Declare Form Class</h2>
<p>
<font color="#000000"><code>
<font color="#0000BB"><?php</font><br>
<br><font color="#007700">include_once </font><font color="#DD0000">'path/to/form.class.php'</font><font color="#007700">;</font>
</font>
</code><br><code><font color="#000000">
<font color="#0000BB">echo $form </font><font color="#007700">= new </font><font color="#0000BB">dyna_form</font><font color="#007700">; </font><br>
<br><font color="#0000BB">?></font></code>
</font>
</p>
<hr>
<h2>Form Tag Object and Attributes</h2>
<code>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">action</font><font color="#006600">(</font><font color="#CC0000">'action='</font><font color="#006600">,</font><font color="#CC0000">'post'</font><font color="#006600">,</font><font color="#CC0000">'target='</font><font color="#006600">);</font><br>
<font color="#000000">Example form: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">action</font><font color="#006600">(</font><font color="#CC0000">'somepage.php'</font><font color="#006600">,</font><font color="#cc0000">'get'</font><font color="#006600">,</font><font color="#CC0000">'_empty'</font><font color="#006600">);</font></code><br>
<br>Note: You must manually close the form tag in your HTML<br><br>
<hr>
<h2>Text Input Type Object and Attributes</h2>
<code>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">text</font><font color="#006600">(</font><font color="#CC0000">'name='</font><font color="#006600">,</font><font color="#CC0000">'value='</font><font color="#006600">,</font><font color="#0000CC">size</font><font color="#006600">,</font><font color="#0000CC">maxlength</font><font color="#006600">,</font><font color="#cc0000">'readonly'</font><font color="#006600">,</font><font color="#CC0000">'CSS classID'</font><font color="#006600">,</font><font color="#CC0000">'tooltip'</font><font color="#006600">,</font><font color="#CC0000">'label'</font><font color="#006600">);</font><br>
<font color="#000000">Example text input</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">text</font><font color="#006600">(</font><font color="#CC0000">'username'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#0000CC">20</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">'Username: '</font><font color="#006600">);</font><br>
<font color="#000000">Example text input</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">text</font><font color="#006600">(</font><font color="#0000CC">date</font><font color="#006600">,</font><font color="#0000CC">date</font><font color="#006600">(</font><font color="#CC0000">'m-d-y'</font><font color="#006600">),</font><font color="#0000CC">20</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#cc0000">'readonly'</font><font color="#006600">,</font><font color="#CC0000">'border'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">);</font></code>
<p><?php echo $form->text('u_date',date('m-d-y'),20,'','readonly','','','Date: '); ?></p>
<hr>
<h2>Submit, Reset and Button Input Object and Attributes</h2>
<code>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">button</font><font color="#006600">(</font><font color="#CC0000">'name='</font><font color="#006600">,</font><font color="#CC0000">'value='</font><font color="#006600">,</font><font color="#CC0000">'button image path - see note'</font><font color="#006600">,</font><font color="#CC0000">'path to go to'</font><font color="#006600">,</font><font color="#CC0000">'CSS classID'</font><font color="#006600">,</font><font color="#CC0000">'tooltip'</font><font color="#006600">);</font><br>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">submit</font><font color="#006600">(</font><font color="#CC0000">'name='</font><font color="#006600">,</font><font color="#CC0000">'value='</font><font color="#006600">,</font><font color="#CC0000">'button image path - see note'</font><font color="#006600">,</font><font color="#CC0000">'CSS classID'</font><font color="#006600">,</font><font color="#CC0000">'tooltip'</font><font color="#006600">);</font><br>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">reset</font><font color="#006600">(</font><font color="#CC0000">'value='</font><font color="#006600">,</font><font color="#CC0000">'CSS classID'</font><font color="#006600">,</font><font color="#CC0000">'tooltip'</font><font color="#006600">);</font><br>
<font color="#000000">Example button input</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">button</font><font color="#006600">(</font><font color="#CC0000">'get_file'</font><font color="#006600">,</font><font color="#CC0000">'Download File'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">'http://somesite.com/'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">);</font><br>
<font color="#000000">Example submit input</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">submit</font><font color="#006600">(</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">'Submit Form'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">'Click here to send info!'</font><font color="#006600">);</font><br>
<font color="#000000">Example submit input</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">submit</font><font color="#006600">(</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">'../images/sub_button.gif'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">);</font><br><font color="#000000">Example reset input</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">reset</font><font color="#006600">(</font><font color="#CC0000">'Reset Form'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">);</font>
</code><br>
<br>Note: Set button image path empty to default to type= button or submit
<br>Note: Set tooltip empty to default to value=
<p><?php echo $form->submit('','Send Info','','','Submit Info Now!');
echo ' ';
echo $form->reset('Reset','','Reset Form'); ?></p>
<p><?php echo $form->button('','Google Search!','','http://google.com','input','Go to Google Search Now!'); ?></p>
<hr>
<h2>Hidden Input Type Object and Attributes</h2>
<code>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">hidden</font><font color="#006600">(</font><font color="#CC0000">'name='</font><font color="#006600">,</font><font color="#CC0000">'value='</font><font color="#006600">);
</font><br><font color="#000000">Example hidden input</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">hidden</font><font color="#006600">(</font><font color="#CC0000">'func'</font><font color="#006600">,</font><font color="#CC0000">'get_id'</font><font color="#006600">);</font>
</code><br><br>
<hr>
<h2>Checkbox Input Type Object and Attributes</h2>
<code>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">checkbox</font><font color="#006600">(</font><font color="#CC0000">'name='</font><font color="#006600">,</font><font color="#CC0000">'value='</font><font color="#006600">,</font><font color="#cc0000">'checked'</font><font color="#006600">,</font><font color="#CC0000">'CSS classID'</font><font color="#006600">,</font><font color="#CC0000">'tooltip'</font><font color="#006600">,</font><font color="#CC0000">'label'</font><font color="#006600">);</font><br>
<font color="#000000">Example checkbox input</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">checkbox</font><font color="#006600">(</font><font color="#CC0000">'send_info'</font><font color="#006600">,</font><font color="#CC0000">'yes'</font><font color="#006600">,</font><font color="#cc0000">'checked'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">);</font>
</code>
<p><?php echo $form->checkbox('info','y','checked','','Tip','Send Newsletter?'); ?></p>
<hr>
<h2>Radio Input Type Object and Attributes</h2>
<code>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">radio</font><font color="#006600">(</font><font color="#CC0000">'name='</font><font color="#006600">,</font><font color="#CC0000">'value='</font><font color="#006600">,</font><font color="#cc0000">'checked'</font><font color="#006600">,</font><font color="#CC0000">'CSS classID'</font><font color="#006600">,</font><font color="#CC0000">'tooltip'</font><font color="#006600">,</font><font color="#CC0000">'label'</font><font color="#006600">);</font><br>
<font color="#000000">Example radio input</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">radio</font><font color="#006600">(</font><font color="#CC0000">'gender'</font><font color="#006600">,</font><font color="#CC0000">'male'</font><font color="#006600">,</font><font color="#cc0000">'checked'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">);</font>
</code>
<p><?php echo $form->radio('gender','m','checked','','Male','Male: ');
echo ' ';
echo $form->radio('gender','f','','','Female','Female: '); ?></p>
<hr>
<h2>File Input Type Object and Attributes</h2>
<code>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">file</font><font color="#006600">(</font><font color="#CC0000">'name='</font><font color="#006600">,</font><font color="#0000CC">size</font><font color="#006600">,</font><font color="#CC0000">'CSS classID'</font><font color="#006600">,</font><font color="#CC0000">'tooltip'</font><font color="#006600">,</font><font color="#CC0000">'label'</font><font color="#006600">);</font><br>
<font color="#000000">Example file input</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">file</font><font color="#006600">(</font><font color="#CC0000">'file'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">'Upload File: '</font><font color="#006600">);</font>
</code>
<p><?php echo $form->file('pic','','','Upload Image File','Upload File: '); ?></p>
<hr>
<h2>Textarea Object and Attributes</h2>
<code>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">textarea</font><font color="#006600">(</font><font color="#CC0000">'name='</font><font color="#006600">,</font><font color="#CC0000">'default text'</font><font color="#006600">,</font><font color="#0000CC">num cols</font><font color="#006600">,</font><font color="#0000CC">num rows</font><font color="#006600">,</font><font color="#CC0000">'wrap type'</font><font color="#006600">,</font><font color="#cc0000">'readonly'</font><font color="#006600">,</font><font color="#CC0000">'CSS classID'</font><font color="#006600">,</font><font color="#CC0000">'tooltip'</font><font color="#006600">,</font><font color="#CC0000">'label'</font><font color="#006600">);</font><br>
<font color="#000000">Example textarea</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">textarea</font><font color="#006600">(</font><font color="#CC0000">'guest_input'</font><font color="#006600">,</font><font color="#CC0000">'Enter Comments Here'</font><font color="#006600">,</font><font color="#0000CC">60</font><font color="#006600">,</font><font color="#0000CC">20</font><font color="#006600">,</font><font color="#CC0000">'virtual'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">'guestBox'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">);</font><br>
<font color="#000000">Example textarea</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">textarea</font><font color="#006600">(</font><font color="#CC0000">'stats'</font><font color="#006600">,</font><font color="#0000CC">$_POST</font><font color="#006600">[</font><font color="#CC0000">'stats'</font><font color="#006600">],</font><font color="#0000CC">60</font><font color="#006600">,</font><font color="#0000CC">20</font><font color="#006600">,</font><font color="#CC0000">'virtual'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">,</font><font color="#CC0000">'guestBox'</font><font color="#006600">,</font><font color="#CC0000">'Enter Reply'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">);</font>
</code>
<p><?php echo $form->textarea('guest_input','Enter Comments Here',50,10,'virtual','','','Enter Comments','Comments: '); ?></p>
<hr>
<h2>Select Menu Object and Attributes</h2>
<code>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">select</font><font color="#006600">(</font><font color="#CC0000">'name='</font><font color="#006600">,</font><font color="#CC0000">'CSS classID'</font><font color="#006600">,</font><font color="#CC0000">'label'</font><font color="#006600">);</font><br>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">option</font><font color="#006600">(</font><font color="#CC0000">'value='</font><font color="#006600">,</font><font color="#CC0000">'option text'</font><font color="#006600">,</font><font color="#CC0000">'selected'</font><font color="#006600">);</font><br>
<font color="#000000">Example select</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">select</font><font color="#006600">(</font><font color="#CC0000">'file_type'</font><font color="#006600">,</font><font color="#CC0000">'selectBox'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">);</font><br>
<font color="#000000">Example option</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">option</font><font color="#006600">(</font><font color="#CC0000">'gif'</font><font color="#006600">,</font><font color="#CC0000">'GIF Image'</font><font color="#006600">,</font><font color="#cc0000">'selected'</font><font color="#006600">);</font></code><br>
<br>Note: You must manually close the select menu in your HTML
<p><?php echo $form->select('hobby','','Hobbies: ');
echo $form->option('wood','Wood Working','');
echo $form->option('cook','Cooking','');
echo $form->option('run','Running','selected'); ?></select></p>
<hr>
<h2>Fieldset/Legend Object and Attributes</h2>
<code>
<font color="#000000">Usage: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">fieldset</font><font color="#006600">(</font><font color="#CC0000">'legend title'</font><font color="#006600">,</font><font color="#CC0000">'CSS classID'</font><font color="#006600">);</font><br>
<font color="#000000">Example select</font><font color="#000000">: </font><font color="#0000CC">echo $form</font><font color="#006600">-></font><font color="#0000CC">fieldset</font><font color="#006600">(</font><font color="#CC0000">'User Input'</font><font color="#006600">,</font><font color="#CC0000">''</font><font color="#006600">);</font></code><br>
<br>Note: Set legend title empty for no heading<br>
Note: You must manually close the fieldset in your HTML
<p><?php echo $form->fieldset('User Info','sub2'); ?> <br><br></fieldset></p>
</form>
<hr>
MT Jordan<br>
<?php echo $link->text('mtjo@netzero.net','','','',''); ?><br>
Emmsoft.com<br>
Updated: April 30, 2003
</body>
</html>
|