e59-website/include/inputs.php
2024-04-11 00:36:04 +02:00

33 lines
1.1 KiB
PHP
Executable File

<?php
function textInput($type, $shapePath, $name, $placeholder, $value) {
echo ('<div class="text-input">');
echo ('<label for="' . $name . '">');
echo ('<svg viewBox="0 0 24 24" aria-hidden="true" class="input-icon">');
echo ('<g>' . $shapePath . '</g>');
echo ('</svg>');
echo ('</label>');
echo ('<input type="' . $type . '" placeholder="' . $placeholder . '" name="' . $name . '" value="' . $value . '">');
echo ('</div>');
}
function fileInput($name) {
echo ('<div class="file-input">');
echo ('<input type="file" name="' . $name . '">');
echo ('</div>');
}
function selectInput($name, $label, $options, $defaultValue) {
echo('<div class="select-input">');
echo('<label for="' . $name . '">' . $label . '</label>');
echo('<select name="' . $name .'" required>');
foreach($options as $value => $name) {
$selectStatus = $value == $defaultValue ? "selected" : "";
echo ('<option value="' . $value .'" ' . $selectStatus . '>' . $name . '</option>');
}
echo('</select>');
echo('</div>');
}
?>