How to pass variables from one php page to another without form?

php, variables

Solution

use the get method in the url. If you want to pass over a variable called 'phone' as 0001112222:

<a href='whatever.php?phone=0001112222'>click</a>

then on the next page (whatever.php) you can access this var via:

$_GET['phone']

Problem

I want to know how to pass a variable from one page to another in PHP without any form. What I want to achieve is this: - The user clicks on a link - A variable is passed which contains a string. - The variable can be accessed on the other page so that I can run mysql queries using that variable.

Original source