Posts

Showing posts from August, 2021

Login Check Module using PHP and HTML

Image
Implementing Login Check using PHP and HTML         In this article we are going to learn how to create a simple Login form using HTML and How to check Login is successful or invalid using PHP Coding .  So create a file called login.php and copy and paste the below code and save it on the server, in some folder. In this file you will see 2 parts. One is the login form code and above the PHP code.  Login form having form tag with name, action, method attributes. Next 2 input tags, one is username - text box- called 'username' and another input tag type password and its name is 'password'. Another input tag is Submit button.  When the User submits the form, then the data the user submitted (username, password) will be transmitted to the server in the form of the post method. PHP checks whether the Submit button is clicked or not, then reads those posted values using name attributes and stores them in PHP variables. Next, It compares them with some constant valu

AJAX with XMLHttpRequest Object

Image
  Implementing AJAX with XMLHttpRequest Object and PHP MySQL     What is Ajax?   AJAX is a technique for accessing web servers from a web page. Updating the part of the webpage with server response without refreshing the page, is called AJAX technique.     XMLHttpRequestObject predefined object in JavaScript.   All the modern browsers will support XMLHttpRequestObject.   AJAX stands for Asynchronous JavaScript And XML.   How it works?   The below picture depicts the Ajax technique flow between client and server.           First client request sent to server through XMLHttpRequestObject The server processes the request and sends a response to the webpage. Client no need to wait for response. Sending and receiving tasks are performed simultaneously.               SQL Query :     CREATE TABLE IF NOT EXISTS `students` ( `id` int ( 11 ) NOT NULL AUTO_INCREMENT , `stuname` varchar ( 30 ) NOT NULL , `age` int ( 11 ) NOT NULL , PRIMARY KEY ( `id` ) ) ENGINE =MyISAM DEFAULT CH

Develop Bootstrap-4 Signup Form in PHP

Image
 How to Develop Bootstrap-4 Signup Form in PHP and MySQL   This article teaches you how to use bootstrap 4 in developing signup form. Bootstrap supports HTML form controls such as textbox, password, email, radio buttons, checkboxes, textarea, buttons and other controls available in html5. So Using some of these controls we are developing a signup form. This code also has MySQL code to store form data in a database. If needed, can enable those commented lines.          bs4-registration-form.php <!doctype html> <html lang= "en" > <head> <!-- Required meta tags --> <meta charset= "utf-8" > <meta name= "viewport" content= "width=device-width, initial-scale=1" > <link rel= "stylesheet" href= "https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" > <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" ></script&

Basic registration form for Signup-PHP

Image
      Learn How to Develope Basic registration form for Signup in PHP and HTML     In this article we are going to learn how to create a basic registration form and connect with PHP . Generally the registration form  method is always 'post'. Post method will submit the user data in a secured manner.  To read from post data PHP uses $_POST inbuilt array.  The below example lets you know how  to read data from various types of form controls and print it in PHP.                   Move Up registration-form.php     <!doctype html> <html lang= "en" > <head> <title> e-trainings Demo - creating registration form using PHP,HTML </title> <meta charset= "utf-8" > </head> <body> <?php if ( isset ( $_POST [ 'submit' ])) { print "<h2>Your details are as follows :</h2><br>" ; echo "username: " . $_POST [ 'user' ] . "<br /

Fileupload in php

Image
  File uploading in PHP     Create the file with code given below and run it on the server. Choose any image or text or PDF file from the folder. And click upload. When the file is uploaded, all the details(like name, type, size, tmp_name etc.) of the file are stored in a super global array variable called $_FILE and the actual file is stored in servers tmp folder in a raw format.  Next the function move_uploaded_file() gets called, it moves raw file contents to its filename and saves it in a given path. Once this task is finished. It displays a "File upload Success" message. Then the file is uploaded to 'uploads' folder. The given example code will also check for the folder 'uploads' is created,  if the folder is not created, it creates and uploads the file into that.  Note : Make sure Form tag must have the attribute enctype : Ex: enctype= "multipart/form-data"   The above attribute encrypted the file while transmitting the file from

Superglobal variables in PHP

Image
How to use Superglobals Variables in PHP   What is Superglobal variables in PHP? In PHP  superglobals are predefined variables . Superglobal can be used to make variables available in every page without declaring them global. They are project level variables, it means  scope of those variables throughout the entire web application. They can be accessed from any page within the web application. Superglobal variables prefixed with $_ and followed by  some name. The name is written in capital letters. It is a predefined name and cannot be changed. $_SERVER $_FILES $_COOKIE $_SESSION $_GET $_POST $_REQUEST $_ENV $GLOBALS In this article we are going to use 3 super global variables. $_GET :  Allows 100 char length URLs. URL can be added to bookmarks. $_POST:  Max limit 8 kb. can be changed.      Post_max_size defined in php.ini.      URL not possible for bookmark.      URL cant be visible in the browser. $_REQUEST: can read $_GET, $_POST, $_COOKIE values.   1. Using GET variable: In th