FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

et1983/simple-php-form: :memo: Easily generate and handle HTML forms in PHP 7. · GitHub

 
 

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple PHP Form

Automatic PHP HTML Form generator class. Handles validation, helpers, warnings and more. Supports text fields, text areas, dropdowns, checkboxes, radio buttons and hidden fields.

Validation types supported: required, email, phone, number, lengthmax *, lengthmin *, sizemax *, sizemin *

<?php 
  require('SimplePHPForm.php'); 
  
  $form = new SimplePHPForm();
  $form->Add('text', 'name', '', array('required'), 'Name', '', 'Your name is required.');
  $form->Add('text', 'email', '', array('required', 'email'), 'Email', '', 'Your email is required.');

  if($form->Validate()) // Did the form validate successfully?
  {
    // Success ! Send an email or register user in a database somewhere...
    $form->Reset(); // Reset to default form.
  }
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>SimplePHPForm Basic Example</title>
    <link rel="stylesheet" type="text/css" media="screen" href="css/simplephpform_default.css" />
  </head>
  <body>
    <?php echo $form->Display(); ?>
  </body>
</html> 

Example Scripts

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

Screenshot of Example

Using Composer

Add to your composer.json file and run php composer update.

{
    "name": "you/your-project",
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/gnat/simple-php-form"
        }
    ],
    "require": {
        "gnat/simple-php-form": "dev-master"
    }
}

Keywords

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

License

This project is licensed under the zlib/libpng license.

About

📝 Easily generate and handle HTML forms in PHP 7.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages


Back | FazBrowse Home | New Git URL