Reputation: 195
I created a function that requires one parameter to be passed into it but I need that parameter to come from another script. How do I embed the variable into a link then put that variable into the function in another script? I know I need to utilize $_GET, isset($_GET['']) and a href but I just can't put it all together.
Upvotes: 2
Views: 3182
Reputation: 693
Use $_REQUEST['something']
Your link must be:
<a href="test.php?something=something&something1=test">Click Me</a>
Inside test.php
if(@$_REQUEST['something']=="something"){
echo $_REQUEST['something1'];
}
When you click Click Me
, test.php
would echo
"test".
Upvotes: 1
Reputation: 1492
$_GET is collection of of query string parameters. If you had a url like: test.php?param1=foo¶m2=bar you can access foo by $_GET['param1'] etc..
Upvotes: 5