2017 © Pedro Peláez
 

library simple-php-form

Automatically generate and handle input forms in PHP.

image

gnat/simple-php-form

Automatically generate and handle input forms in PHP.

  • Wednesday, August 17, 2016
  • by geenat
  • Repository
  • 2 Watchers
  • 3 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 1 Versions
  • 6 % Grown

The README.md

📝 Simple PHP Form

workflow, (*1)

Automatic HTML <form> with validation, messages, warnings and more!, (*2)

  • Form fields: text, textarea, dropdown, checkbox, radio and hidden
  • Validators: required, email, phone, number, lengthmax *, lengthmin *, sizemax *, sizemin *
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.
  }
?>
<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" type="text/css" media="screen" href="css/simplephpform_default.css" />
  </head>
  <body>
    <?php echo $form->display(); ?>
  </body>
</html> 

🎁 Installation

This is a zero dependency library., (*3)

Just drag SimplePHPForm.php into your project and require('SimplePHPForm.php');, (*4)

Optionally add the assets from examples/css and examples/images to your project., (*5)

👁️ Examples + Screenshot

  • Basic usage: ./examples/basic.php
  • Advanced usage: ./examples/advanced.php
  • Center-aligned usage: ./examples/centered.php

Simple PHP Form Example 1, (*6)

Keywords

Forms, User Feedback, Model View Controller, PHP 8 Compatible, PHP 8+, email, input, simple, lean., (*7)

The Versions

17/08 2016

dev-master

9999999-dev https://github.com/gnat/simple-php-form

Automatically generate and handle input forms in PHP.

  Sources   Download

Zlib

The Requires

  • php ^5.3.0 || ^7.0

 

helpers email form validation response forms input feedback warnings