A website build using Astro includes a HTML form to capture name, email and message - the website is to be deployed via Cloudflare and should use only the CLoudflare D1 database connected via a Cloudflare worker - no ORM or similar.
D1 is created and table "contact-form" is defined @ Cloudflare - three columns, "email" (pk), "name", "message", each with text values.
Wrangler is installed for Astro, as is the Cloudflare adapter (which is running).
Worker is created @ Cloudflare and in the wrangler.json file, the D1 database is attached via a binding (the "xxx" refers to the unique DB ID provided by Cloudflare):
"d1_databases": [{
"binding": "DB",
"database_name": "contact-db",
"database_id": "xxx"
}
HTML form:
<form method="POST">
<label for="user-email">E-Mail*</label>
<input type="email" id="user-email" name="user-email" value="Your email" required></input>
<label for="user-name">Name</label>
<input type="text" id="user-name" name="user-name" value="Your name (optional)"></input>
<label for="user-message">Message</label>
<input type="text" id="user-message" name="user-message" value="Your message (optional)"></input>
<input type="submit" value="Submit">
</form>
Now, what do I need to create and where in my project to INSERT the form submission into the database?