home

PHP Super Global Variables Or Builtin Variables Tutorial


Super globale variables in php are those variables, that are defined already. So you dont have to define them. You can use them on any php page, thats why they are known as super global. The examples of super global varibles are $_COOKIE is for making cookie files. Cookies are used to store data in files on client's computer $_SESSION is for making Session. Session is used to saving information in memory $_POST is used for getting data from a web form $_GET is used for getting data from a web form or from browser $_ENV is for giving us the specification of our environment $_FILES is used for uploading files $_REQUEST is used for getting data from clients $_SERVER contanis the path and infomation about server

UPLOAD Files using Super Global Variables

<?php
echo "From : ";
echo $from = $_POST['from'];
echo "<BR>";

echo "TO : ";
echo $to = $_POST['to'];
echo "<BR>";

echo "Subject : ";
echo $subject = $_POST['subject'];
echo "<BR>";

echo "Message : ";
echo $message = $_POST['message'];
echo "<BR>";

//$target = "images/";
$target = basename($_FILES['photo'] ['name']);
$size = $_FILES['photo'] ['size'];
$type = $_FILES['photo'] ['type'];
echo "The size of your uploaded file is = " . $size . "<BR>";
echo "The type of your uploaded file is = " . $type . "<BR>";

if (move_uploaded_file($_FILES['photo'] ['tmp_name'], $target))
{
echo "Your file has been successfully uploaded";
}
else
{
echo "Sorry! I can not upload your file....";
}
?>


Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

all rights reseverd by Cramerz.com©. web development by web design company DotPeak. hosting by HostBay
all contents on cramerz are the property of Cramerz.com. web design courses