UK Business Directory
Discover and connect with local businesses
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add Business Listing (Admin Only)</title>
<style>
body { font-family: Arial, sans-serif; padding: 2rem; background: #f2f2f2; }
h1 { text-align: center; }
form { max-width: 600px; margin: auto; background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
input, textarea { width: 100%; padding: 0.75rem; margin-bottom: 1rem; border: 1px solid #ccc; border-radius: 4px; }
button { padding: 0.75rem 1.5rem; background: #333; color: white; border: none; border-radius: 4px; cursor: pointer; }
button:hover { background: #555; }
#output { white-space: pre-wrap; background: #eee; padding: 1rem; border-radius: 6px; }
</style>
</head>
<body>
<h1>Generate Business Listing Code</h1>
<form id="entryForm">
<input type="text" id="name" placeholder="Business Name" required>
<input type="text" id="category" placeholder="Category" required>
<input type="text" id="location" placeholder="Location" required>
<input type="number" id="rating" min="1" max="5" placeholder="Rating (1–5)" required>
<input type="text" id="logo" placeholder="Logo URL">
<textarea id="description" placeholder="Short Description" required></textarea>
<button type="submit">Generate Listing</button>
</form>
<div id="output"></div>
<script>
const form = document.getElementById('entryForm');
const output = document.getElementById('output');
form.addEventListener('submit', function(e) {
e.preventDefault();
const name = document.getElementById('name').value;
const category = document.getElementById('category').value;
const location = document.getElementById('location').value;
const rating = document.getElementById('rating').value;
const logo = document.getElementById('logo').value || 'https://via.placeholder.com/100';
const description = document.getElementById('description').value;
const code = `{
name: '${name}',
category: '${category}',
location: '${location}',
rating: ${rating},
description: '${description}',
logo: '${logo}'
},`;
output.textContent = code;
form.reset();
});
</script>
</body>
</html>
