No of visitors who read this post: 297
Category: PHP
Type: Question
Your rating: None Average: 5 (1 vote)

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.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

#

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;

?>