Steve Dogiakos 83775b716f Add server-side input validation
- Validate that first_name, last_name, email, and location are provided
- Add regex-based email format validation in app.py
- Display error messages on the guestbook form if validation fails

These changes help ensure that only properly formatted data is stored.
2025-04-01 18:01:58 -06:00

38 lines
1.0 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Museum Visitor Guestbook</title>
</head>
<body>
<h1>Museum Visitor Guestbook</h1>
{% if error %}
<div style="color: red;">{{ error }}</div>
{% endif %}
<form method="post" action="/">
<label for="first_name">First Name(s):</label><br>
<input type="text" id="first_name" name="first_name" required><br><br>
<label for="last_name">Last Name:</label><br>
<input type="text" id="last_name" name="last_name" required><br><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" required><br><br>
<label for="location">Location:</label><br>
<input type="text" id="location" name="location" required><br><br>
<input type="submit" value="Submit">
</form>
<hr>
<h2>Guest Entries</h2>
<ul>
{% for guest in guests %}
<li><strong>{{ guest[0] }}</strong> from {{ guest[1] }}</li>
{% endfor %}
</ul>
</body>
</html>