HW start
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<?php include_once "../../base/meta.php" ?>
|
||||
|
||||
<title>Colour Selector</title>
|
||||
|
||||
<script src="./js/formValidation.js"></script>
|
||||
|
||||
<?php
|
||||
// PHP
|
||||
include_once "../../base/settings.php";
|
||||
include_once "../../base/headers.php";
|
||||
|
||||
if (isset($_POST["colour"])) {
|
||||
$colour = $_POST["colour"];
|
||||
|
||||
if (preg_match("^#([0-9A-Fa-f]{3,4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$", $colour) === false) {
|
||||
$error = "Invalid hex colour";
|
||||
}
|
||||
}
|
||||
|
||||
Headers::html();
|
||||
?>
|
||||
</head>
|
||||
|
||||
<body style="background-color: <?=$colour?>">
|
||||
|
||||
<div class="form-check form-switch m-3">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="clientSideValidate">
|
||||
<label class="form-check-label" for="clientSideValidate">Use Client Side Validation</label>
|
||||
</div>
|
||||
<form method="post" class="needs-validation row m-0" novalidate>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="colour">Colour Code</label>
|
||||
<input class="form-control" id="colour" name="colour" required pattern="^#([0-9A-Fa-f]{3,4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$" />
|
||||
<div class="invalid-feedback">
|
||||
Please enter valid hex colour code
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary mt-3" name="firstLoad" value="0">Berechnen</button>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user