Class on PHP by Chandra sir


Today chandra sir took class on PHP with our request . He gave basic about PHP syntax .

and also he told about diffrent types of Super Global Variables .

Super Global Variables

  1. $_SERVER
  2. $_REQUEST
  3. $_POST
  4. $_GET
  5. $_COOKIE
  6. $_SESSION
  7. $_FILES

$_SERVER –   This gives information about environment variables.

tell about information of server.

to see the variables of $_SERVER.


<html>
<?php
 print "<table border = 1>";
 foreach ($_SERVER as $key => $value) {

 print "<tr><td>$key</td><td>$value</td></tr>";

}
 print "</table>";
?>
</html>

This is all information about server .

we can see what information you need about server individually.

like

<?= $_SERVER[‘DOCUMENT_ROOT’] ?>

output : /var/www

<?= $_SERVER[‘SCRIPT_FILENAME’] ?>

output : /var/www/php_exc/document.php

Then he told about $_GET and $_POST  and also about $_REQUEST .

$_GET can e used for ‘method = get’ and

$_POST can be used for ‘method = post’

$_REQUEST can be used for both ‘method = get and post’

And also told differnce about these super global variable.

<form method = “POST” action = “<?= $_SERVER[‘PHP_SELF’] ?>”

this will send request to same page . This is used for security purpose

He told how to upload file using PHP. It was easy .

He made us to understand many thing in PHP today . It was vey useful

Thank u


Advertisements

About sathia

Web developer at cloudmint
This entry was posted in Web. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s