Forms & Functionality
Basic Form Setup
HTML forms collect information:
Form Attributes
action- Where form data is sent (process.php file)method- How data is sent (POST is secure)required- Field must be filled
Input Types
Processing Form Submissions
To actually process forms, you need:
- Server-side processing (PHP, Node.js, etc.)
- Form handler file (process.php)
- Email or database setup
Simple Email Form Handler (PHP)
Create process.php:
Update your form:
Using External Services for Forms
Easier alternative - use form services that don't require server-side code:
Using Formspree.io:
Steps:
1. Go to Formspree.io
2. Create account
3. Get your form ID
4. Update action with your ID
5. Forms now work without server code
Other Services
- Basin - Simple form service
- Netlify Forms - If hosting on Netlify
- GetForm - More features
- Fabform - Email notifications
Form Validation (JavaScript)
Add JavaScript to validate before sending:
Common Form Elements
Required field:
Placeholder text:
Dropdown:
Checkboxes:
I agree
Radio buttons:
Yes
No