I am beginner at programming and I am making a website project, which has a contact form and I have to somehow save the data from the inputs. I can only do it with local storage, but in this case it saves only the last input and I want to save the data on a json server.
This is my HTML for the contact form:
<section class="enquiries">
<input type="text" name="name" id="name" autofocus="autofocus" placeholder=" Name:"></input>
<br>
<input type="email" name="email" id="email" placeholder=" Email:"></input>
<br>
<input type="text" name="subject" id="subject" placeholder=" Subject:"></input>
<br>
<textarea id="extra" name="extra" placeholder=" Message..."></textarea>
</section>
<button class="button" type="submit">Send</button>
I have already installed json server, created a db.json file in which I have this:
{
"contactInfo": [
{
"id": 1,
"name": "",
"email": "",
"subject": "",
"extra": ""
}
]
}
it works when I make requests with Postman. How can I connect it with my server and how can I save the data from the inputs?
I will be very grateful if you help me. Thanks in advance.