Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 34 additions & 15 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Product Pick</title>
<link rel="stylesheet" href="style.css" />
</head>

<body>
<header>
<h1>Product Pick</h1>
</header>
<main>
<form>
<!-- write your html here-->
<!--
try writing out the requirements first as comments
this will also help you fill in your PR message later-->
<h1>Product Pick</h1>

<form action="result.html" method="GET">
<fieldset>
<legend>Choose your T-shirt</legend>

<label for="name">Name:</label>
<input type="text" id="name" name="name" required />

<label for="colour">Colour:</label>
<select id="colour" name="colour" required>
<option value="">Select a colour</option>
<option value="Black">Black</option>
<option value="White">White</option>
<option value="Blue">Blue</option>
</select>

<label for="size">Size:</label>
<select id="size" name="size" required>
<option value="">Select a size</option>
<option value="Small">Small</option>
<option value="Medium">Medium</option>
<option value="Large">Large</option>
</select>

<button type="submit">Submit</button>
</fieldset>
</form>
</main>

<footer>
<!-- change to your name-->
<h2>By HOMEWORK SOLUTION</h2>
<h2>By Alasdair MacDonald</h2>
</footer>
</body>
</html>
28 changes: 28 additions & 0 deletions Form-Controls/results.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Form Result</title>
<link rel="stylesheet" href="style.css" />
</head>

<body>
<main>
<h1>Your Selection</h1>

<p><strong>Name:</strong> <span id="name"></span></p>
<p><strong>Colour:</strong> <span id="colour"></span></p>
<p><strong>Size:</strong> <span id="size"></span></p>

<a href="index.html">Go back</a>
</main>

<script>
const params = new URLSearchParams(window.location.search);
document.getElementById("name").textContent = params.get("name");
document.getElementById("colour").textContent = params.get("colour");
document.getElementById("size").textContent = params.get("size");
</script>
</body>
</html>