Code Monkey home page Code Monkey logo

php-form-submission's Introduction

php simple form-submission a mvc pattern framework using raw php

Simple PHP form submission script with front end and back end validation

tech specifications
- php version 7.4
- jQuery version 3.5.0
- Bootstrap
- HTML and CSS 
Installation

The installation is pretty simple. There is nothing like composer update. You will have php version 7.4 and jQuery version 3.5.0 thats it. Below, the details installation is being described.

  1. XAMPP installation:
  • Go to your htdocs directory of your xampp folder and clone the project from github direcotory to your xampp htdocs directory using the following command for https. git clone [email protected]:zrshishir/php-form-submission.git
  • Create a database on your phpmyadmin or mysql
  • Import the form-submission.sql (it is in the root directory) file into your database.
    • Set your database credentials in DatabaseConnection.php file which is in app/controller directory and edit $host, $user, $password and $database with you own credentials:
       private $host = 'localhost';
       private $user = 'root';
       private $password = 'your password';
       private $database = 'database name';
      
  • Now open your browser and execute the index.php file which is in your project root directory.
  1. LEMP stack installation:
    • Make ready your linux with nginx, mysql and php. You can follow the link LEMP stack installation on ubunut 18.04
    • Create a database on your phpmyadmin or mysql
    • Import the form-submission.sql (it is in the root directory) file into your database.
    • Set your database credentials in DatabaseConnection.php file which is in app/controller directory and edit $host, $user, $password and $database with you own credentials.
    • Now open your browser, write your domain name and execute the index.php file which is in your project root directory.
Project features:
- Maintaining mvc pattern
- User's browser ip automatically taken when submiting the form
- Encryption receipt id with proper salt and using sha-512
- taking local time zone at entry time
- Back end validation
- Front end validation
- Form submission with ajax and php (for php form submission you need some edition in the code)
- Preventing users from multiple submissions within 24 hours using cookie
- Including search opton with entry_by, from date and to date
- Integrating the ajax response with resetting the form value
Done Tasks:
  1. Create a MySQL DB table with the following requirements and a frontend submission form for storing the data. The - field/Column list are:

    • id (bigint 20) ai
    • amount (int 10) *
    • buyer (varchar 255) *
    • receipt_id (varchar 20) *
    • items (varchar 255) *
    • buyer_email (varchar 50) *
    • buyer_ip (varchar 20)
    • note (text) *
    • city (varchar 20) *
    • phone (varchar 20) *
    • hash_key (varchar 255)
    • entry_at (date)
    • entry_by (init 10) *
    • marked columns can be submitted through the mentioned frontend form.
  2. Buyer_ip should be the user’s browser ip and will be automatically filled up from backend.

  3. Hash_key is the encrypted string of ‘receipt_id’ and a proper ‘salt’ using sha-512.

  4. Entry_at is the submission date in local timezone.

  5. There will be two types of validation process according to the following requirements: A) frontend validation (with js entirely), B) backend validation.

    • Amount: only numbers.
    • Buyer: only text, spaces and numbers, not more than 20 characters.
    • Receipt_id: only text.
    • Items: only text, user should be able to add multiple items (use js based interface).
    • Buyer_email: only emails.
    • Note: anything, not more than 30 words, and can be input unicode characters too.
    • City: only text and spaces.
    • Phone: only numbers, and 880 will be automatically prepended via js in an appropriate manner.
    • Entry_by: only numbers.
  6. The submission must be handled by jquery ajax.

  7. Using cookie, prevent users from multiple submissions within 24 hours.

  8. Create a simple report page where users can see all the submissions and filter it by date range and/ or user id.

Screenshots

Main Page Main page

Receipt Submission Formm Submission form

Searching Form Searching form

Cookie Validation Cookie Validation

Form Validation Part1 Form Validation

Form Validation Part2 Form Validation

Form Part3 Form Validation,

Form Part4 Form Validation

NB: If you face any issue, please inform me.

php-form-submission's People

Contributors

zrshishir avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.