How to Build a Form That Saves Data to a Database
Want a form that actually collects submissions? In Div-idy, you can create a form and save the data by simply saying so in your prompt. Div-idy will handle the database connection automatically.
Quick Answer
In your prompt, say you want to create a form and you want the submissions saved. Div-idy will generate the form and connect it to a database automatically. You can access the saved entries from your project page using the Database tool.
What to include in your prompt
- Form purpose: contact, lead capture, signup, order form, etc.
- Fields: what inputs you want (name, email, phone, message, etc.)
- Validation: required fields + email format checks
- Database saving: explicitly say “save submissions to the database”
- Feedback: success message + error message states
Be specific about field names. Those become the database fields, so consistency matters.
Step-by-step
Prompt Div-idy to create a form and save data
Tell Div-idy what form you want and that submissions should be stored.
Example prompt:
Create a contact form that saves submissions to a database.
Fields:
- fullName (required)
- email (required, validate format)
- company (optional)
- message (required)
After submit:
- Save to database
- Show a success message
- Clear the form
Generate and test
Generate the app, submit the form once, and confirm the success message appears.
Click: Generate
Test: Submit a sample entry
Access your database
From your project page, open the Database tool to view submissions.
Project page → Tools
Click: Database
View: saved records
Prompt templates (copy/paste)
Create a lead capture form that saves submissions to a database.
Fields:
- name (required)
- email (required, validate)
- phone (optional)
- notes (optional)
Behavior:
- Save to database
- Show success message
- Prevent empty submissions
- Add spam protection messaging (basic)
Create an order form that saves orders to a database.
Fields:
- customerName
- email
- item
- quantity
- address
Behavior:
- Validate required fields
- Save order to database with timestamp
- Show "Order received" confirmation