Getting Value from other PHP page

Asked By 40 points N/A Posted on -
qa-featured

I have this problem on how to pass or get value or variable from one PHP page to the other. Is there any easy way or functions on how to do this? Please Help.

SHARE
Answered By 5 points N/A #104557

Getting Value from other PHP page

qa-featured

Dear friend,

  • There are three methods in PHP through which you can get value from other PHP pages.

$_POST: It is used to get value from another PHP page which uses method as post.

When this method is used the data is not visible to others.

$_GET: It is used to get value from another PHP page which uses method as get.

When this method is used the data is visible to others in URL.

$_REQUEST: Using this method you can get value which uses method as get, post & cookie.

This method is somewhat not safe to use.

Examples

$_POST

<?PHP

//$_POST[‘input name here’];

$phoneno=$_POST[‘phone’];

echo $phoneno;

?>

 

$_GET

<?PHP

//$_GET[URL variable name’];

$phoneno=$_GET[‘phone’];

echo $phoneno;

?>

 

$_REQUEST

<?PHP

//$_ REQUEST [‘input name here’ | URL variable name’ | ’cookie’];

$phoneno=$_ REQUEST [‘phone’];

echo $phoneno;

?>

Related Questions