I am trying to execute a php "runMyFunction($para)" function which takes in a string parameter when clicking on an image
echo '<a href="index.php?similair=true"><img src="'. $location. '" alt="'. $name, '" />';
and my php funtion is
function runMyFunction($input) {
echo $input;
}
if (isset($_GET['similair'])) {
runMyFunction();
}
My question is how can I pass another string value so I can use it inside the $_GET checking part to pass it as a parameter in my function
Any help would be much appreciated
Assuming you want a second parameter named param2 and you want pass the value 'test'
echo '<a href="index.php?similair=true¶m2=test">
<img src="'. $location. '" alt="'. $name, '" />';
function runMyFunction($input) {
echo $input;
}
if (isset($_GET['similair'])) {
runMyFunction( $_GET['param2']);
}