diff options
author | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-09-17 16:48:29 +0200 |
---|---|---|
committer | Nicolas BERNSTEIN <alexis211@gmail.com> | 2011-09-17 16:48:29 +0200 |
commit | d0060968b77c39bdf8abffb071c971c166b59edb (patch) | |
tree | 0be52e00a25bd298235a0cf916fb07496d3ab95f /tpl/general/inc_form.php | |
download | Bits-d0060968b77c39bdf8abffb071c971c166b59edb.tar.gz Bits-d0060968b77c39bdf8abffb071c971c166b59edb.zip |
First commit.
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>'; |