Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gnat/simple-php-form
:memo: Easily create and validate HTML forms in PHP 8.
https://github.com/gnat/simple-php-form
form forms php php-form php8 validation
Last synced: 3 months ago
JSON representation
:memo: Easily create and validate HTML forms in PHP 8.
- Host: GitHub
- URL: https://github.com/gnat/simple-php-form
- Owner: gnat
- Created: 2013-06-19T19:32:01.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-06-27T19:44:07.000Z (over 1 year ago)
- Last Synced: 2024-10-11T18:18:16.676Z (3 months ago)
- Topics: form, forms, php, php-form, php8, validation
- Language: PHP
- Homepage:
- Size: 97.7 KB
- Stars: 27
- Watchers: 5
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
📝 Simple PHP Form
==================
![workflow](https://github.com/gnat/simple-php-form/actions/workflows/test.yml/badge.svg)Automatic HTML `` with validation, messages, warnings and more!
* Form fields: `text`, `textarea`, `dropdown`, `checkbox`, `radio` and `hidden`
* Validators: `required`, `email`, `phone`, `number`, `lengthmax *`, `lengthmin *`, `sizemax *`, `sizemin *````php
add('name', 'text', '', ['required'], 'Name', '', 'Your name is required.');
$form->add('email', 'text', '', ['required', 'email'], 'Email', '', 'Your email is required.');if($form->validate()) // Did the form validate successfully?
{
// Get data: $form->get('name'); ...
// Success ! Send an email or register user in a database somewhere...
$form->reset(); // Reset to default form.
}
?>
display(); ?>
```## 🎁 Installation
This is a zero dependency library.
Just drag `SimplePHPForm.php` into your project and `require('SimplePHPForm.php');`
Optionally add the assets from `examples/css` and `examples/images` to your project.
## 👁️ Examples + Screenshot
* Basic usage: **./examples/basic.php**
* Advanced usage: **./examples/advanced.php**
* Center-aligned usage: **./examples/centered.php**## Keywords
Forms, User Feedback, Model View Controller, PHP 8 Compatible, PHP 8+, email, input, simple, lean.