|
Version 1.0.2a Simple form creator that allows you to quickly create forms on the fly. The Class <?php class FormMaker { function StartForm($fm_action, $fm_method, $fm_name) { // StartForm : # $fm_action = the form action # $fm_method = the form method post/get # $fm_name = the form id (used for conjunction with javascript) $form = "<form action=".$fm_action." id=".fm_name." method=".$fm_method."><table>"; return $form; } function AddTextBox($tb_value, $tb_name) { // AddTextBox: # $tb_value = Text box value : IE what the text box will be used for # $tb_name = the name of the input tag, used when getting data after a post. $form = "<tr><td>".$tb_value."</td><td><input type='text' name=".$tb_name." /></td></tr>"; return $form; } function AddPassBox($tbp_value, $tbp_name) { // AddPassBox: # $tbp_value = Text box value : IE what the text box will be used for # $tbp_name = the name of the input tag, used when getting data after a post. $form = "<tr><td>".$tbp_value."</td><td><input type='password' name=".$tbp_name." /></td></tr>"; return $form; } function AddTextArea($ta_name, $ta_value) { // AddTextArea: # $ta_value = Text box value : IE what the text box will be used for # $ta_name = the name of the textarea tag, used when getting data after a post. $form = "<tr><td>".$ta_value."</td><td><textarea name=".$ta_name." cols='5' rows='30' ></textarea></td></tr>"; return $form; } function AddButton($b_value) { // AddButton: # $b_value = the output of the submit button shown on screen. $form = "<tr><td><input type='submit' value='".$b_value." /></td></tr>"; return $form; } function EndForm() { $form = "</table></form>"; return $form; } } ?>
how to use <?php $FormMaker = new FormMaker;
echo $FormMaker->StartForm($_SERVER['PHP_SELF'], 'post', 'loginform'); echo $FormMaker->AddTextBox('Username', 'username'); echo $FormMaker->AddPassBox('Password', 'password'); echo $FormMaker->AddButton("Login"); echo $FormMaker->EndForm();
?>
simple login form using the FormMaker. More features expected for version 2
Last Edit: Sept 4, 2006 17:36:24 GMT by Llanilek
|
|
|
|
|
You should cover all the form types: - file uploads - select and options - checkboxes - buttons (not submit button, input type="button") - reset button - hidden - radio Those are the ones you missed (to my knowledge). That's my only real suggestion besides making it so it stores the information of the form generated and can be used for validation too.
Last Edit: Sept 6, 2006 1:32:46 GMT by Chris
|
|
|
|
|
You should cover all the form types: - file uploads - select and options - checkboxes - buttons (not submit button, input type="button") - reset button - hidden - radio Those are the ones you missed (to my knowledge). That's my only real suggestion besides making it so it stores the information of the form generated and can be used for validation too. and they all will be made available in version 2
|
|
|
|
|
Even the checking side of things?
|
|
|
|
|
Version 1.0.2a Simple form creator that allows you to quickly create forms on the fly. The Class <?php class FormMaker { function StartForm($fm_action, $fm_method, $fm_name) { // StartForm : # $fm_action = the form action # $fm_method = the form method post/get # $fm_name = the form id (used for conjunction with javascript) $form = "<form action=".$fm_action." id=".fm_name." method=".$fm_method."><table>"; return $form; } function AddTextBox($tb_value, $tb_name) { // AddTextBox: # $tb_value = Text box value : IE what the text box will be used for # $tb_name = the name of the input tag, used when getting data after a post. $form = "<tr><td>".$tb_value."</td><td><input type='text' name=".$tb_name." /></td></tr>"; return $form; } function AddPassBox($tbp_value, $tbp_name) { // AddPassBox: # $tbp_value = Text box value : IE what the text box will be used for # $tbp_name = the name of the input tag, used when getting data after a post. $form = "<tr><td>".$tbp_value."</td><td><input type='password' name=".$tbp_name." /></td></tr>"; return $form; } function AddTextArea($ta_name, $ta_value) { // AddTextArea: # $ta_value = Text box value : IE what the text box will be used for # $ta_name = the name of the textarea tag, used when getting data after a post. $form = "<tr><td>".$ta_value."</td><td><textarea name=".$ta_name." cols='5' rows='30' ></textarea></td></tr>"; return $form; } function AddButton($b_value) { // AddButton: # $b_value = the output of the submit button shown on screen. $form = "<tr><td><input type='submit' value='".$b_value." /></td></tr>"; return $form; } function EndForm() { $form = "</table></form>"; return $form; } } ?>
how to use <?php $FormMaker = new FormMaker;
echo $FormMaker->StartForm($_SERVER['PHP_SELF'], 'post', 'loginform'); echo $FormMaker->AddTextBox('Username', 'username'); echo $FormMaker->AddPassBox('Password', 'password'); echo $FormMaker->AddButton("Login"); echo $FormMaker->EndForm();
?>
simple login form using the FormMaker. More features expected for version 2 How aboutt releasing mfHosting now? j/k Nice job for those getting started.
|
|
|
|
Even the checking side of things? yes even the checking side of things How aboutt releasing mfHosting now? j/k 20th october birthday release again lol
Last Edit: Sept 11, 2006 0:46:41 GMT by Llanilek
|
|
|
|