Sunday, 24 April 2016

WEEK8_Class of PHP & Form

In this class, we are learning about new things - PHP and FORM.

OK, what is PHP. PHP is really good at handling data submitted to the server in HTML forms. HTML forms allow users to enter data into a web page.

Simple Form Precessing

<form METHOD= "GET"
           ACTION=  "process.php">


2 main attribute in a form :

1*METHOD
   Get/post

2*ACTION
    -used to specify the target which is where the data is to be transmitted.
    -the target is a file that contains code for processing.


$_GET variable

  • an array of variable names and value sent by the HTTP GET method
$_POST variable
  • an array of viarable names and values sent by the HTTP POST method.
$_REQUEST variable
  • contain the content of both $_GET, $_POST, $_COOKIES.
  • used to get the result from form data sent with both the GET and POST methods.


Example of Getting form value: 


Example of Displaying submitted values: 


Authentication using USERNAME & PASSWORD
  • allowing a user to access private information or preventing them from doing so.

Example of aunthenification



Managing Session
  • duration for which a user is connected to a site.
  • also as a block of information that stores variable and values.
  • feature: i. consist of an identification string.
i. to start a session and to track session variable across user session

session_start();

ii. to register a session

session_register (variable);

iii. to destroy a session

session_destroy();





No comments:

Post a Comment