update,
This commit is contained in:
78
tsc1877/task1/_ref/old_project/form.html
Normal file
78
tsc1877/task1/_ref/old_project/form.html
Normal file
@@ -0,0 +1,78 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>IERG4210 Admin Panel</title>
|
||||
<style>
|
||||
#drop-area {
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
border: 2px dashed #ccc;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 0 auto;
|
||||
margin-top: 20px;
|
||||
}
|
||||
#drop-area.highlight {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
#drop-area .message {
|
||||
margin: 80px auto;
|
||||
font-size: 18px;
|
||||
color: #888;
|
||||
}
|
||||
#thumbnail {
|
||||
max-width: 200px;
|
||||
max-height: 200px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>IERG4210 Admin Panel</h1>
|
||||
<h1>Add Category</h1>
|
||||
<form action="/addCategory" method="POST">
|
||||
<label for="categoryName">Category Name:</label>
|
||||
<input type="text" id="categoryName" name="categoryName" required>
|
||||
<button type="submit">Add Category</button>
|
||||
</form>
|
||||
|
||||
<h1>Add Product</h1>
|
||||
<form action="/addProduct" method="POST">
|
||||
<label for="productName">Product Name:</label>
|
||||
<input type="text" id="productName" name="productName" required>
|
||||
|
||||
<label for="category">Category:</label>
|
||||
<select id="category" name="category" required>
|
||||
<option value="" selected disabled>Select a category</option>
|
||||
<script>
|
||||
// Fetch categories from the server and populate the dropdown options
|
||||
fetch('/categories')
|
||||
.then(response => response.json())
|
||||
.then(categories => {
|
||||
const categorySelect = document.getElementById('category');
|
||||
categories.forEach(category => {
|
||||
const option = document.createElement('option');
|
||||
option.value = category.catid;
|
||||
option.textContent = category.name;
|
||||
categorySelect.appendChild(option);
|
||||
});
|
||||
})
|
||||
.catch(error => console.error(error));
|
||||
</script>
|
||||
</select>
|
||||
|
||||
<label for="price">Price:</label>
|
||||
<input type="number" id="price" name="price" required>
|
||||
|
||||
<label for="description">Description:</label>
|
||||
<textarea id="description" name="description" required></textarea>
|
||||
|
||||
<label for="image">Image:</label>
|
||||
<input type="file" id="image" name="image" accept="image/*" required>
|
||||
|
||||
<button type="submit">Add Product</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user