diff options
Diffstat (limited to 'tpl/general/inc_form.php')
-rw-r--r-- | tpl/general/inc_form.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tpl/general/inc_form.php b/tpl/general/inc_form.php new file mode 100644 index 0000000..8cd2ad5 --- /dev/null +++ b/tpl/general/inc_form.php @@ -0,0 +1,26 @@ +<?php + + +if (!isset($method)) $method = "POST"; +if (!isset($validate)) $validate = "Post"; +if (!isset($action)) $action = "index.php?p=$url"; + +echo '<form method="' . $method . '" action="' . $action . '"' . + (isset($need_file) ? ' enctype="multipart/form-data"' : '') . '>'; +if (isset($form_message)) echo '<strong>' . $form_message . "</strong><br /><br />\n"; + +foreach($fields as $f) { + if (isset($f['type']) && $f['type'] == 'textarea') { + echo '<label>' . $f['label'] . '</label><br />'; + echo '<textarea name="' . $f['name'] . '">' . $f['value'] . '</textarea><br />'; + } else { +?> +<label for="ff_<?php echo $f['name']; ?>"><?php echo $f['label']; ?></label> +<input type="<?php echo (isset($f['type']) ? $f['type'] : 'text'); ?>" name="<?php echo $f['name']; ?>" <?php +if (isset($f['value'])) echo ' value="' . $f['value'] . '"' ; +if (isset($f['checked']) && $f['checked'] == true) echo ' checked="checked"'; +?> id="ff_<?php echo $f['name']; ?>"/><br /><?php + } +} + +echo '<div class="empty_label"> </div><input type="submit" value="' . $validate . '" /></form>'; |