28 lines
1.3 KiB
PHP
Executable file
28 lines
1.3 KiB
PHP
Executable file
<?php
|
|
function form($title, $form_message, $inputs, $action = '') { ?>
|
|
<form class='form' enctype="multipart/form-data" method="POST" action="<?php echo $action ?>">
|
|
<h1 class="form-heading">
|
|
<?php echo htmlspecialchars($title) ?>
|
|
</h1>
|
|
<span class='form-message'>
|
|
<?php echo htmlspecialchars($form_message) ?>
|
|
</span>
|
|
<?php
|
|
foreach ($inputs as $kv) { ?>
|
|
<span class='form-key'>
|
|
<?php echo htmlspecialchars($kv['key']) ?>
|
|
</span>
|
|
|
|
<<?php echo (($kv['type'] == 'textarea') ? 'textarea' : 'input') ?>
|
|
class='form-input'
|
|
type="<?php echo htmlspecialchars($kv['type']) ?>"
|
|
name="<?php echo htmlspecialchars($kv['name']) ?>"
|
|
<?php echo ($kv['type'] == 'hidden') ? 'hidden' : ''?>
|
|
value="<?php echo ($kv['type'] == 'textarea') ? '' : htmlspecialchars($kv['default']) ?>"
|
|
><?php echo (($kv['type'] == 'textarea') ? htmlspecialchars($kv['default']) . '</textarea>' : '') ?>
|
|
<?php }
|
|
?>
|
|
<input class='form-button' type="Submit" name="Submit">
|
|
</form>
|
|
<?php }
|
|
?>
|