I'm not sure what is the problem here.
I am using a plugin in wordpress that displays a popup for the users to sign up to the mailing list.
In this plugin, I want to be able to add a variable in a hidden field to post along so I can tell if the user has come from a specific affiliate campaign.
In the url I have
http://example.com/?urlref=affname
and in the modal window that pops up I have coded:
<?php if(isset($_GET['urlref'])) { ?>
// do stuff here
<?php } else { ?>
<p>No Aff Link</p>
<?php } ?>
and what i am getting returned is No Aff Link
I have tried using
$_REQUEST['urlref']
but that does not work either.
I have added the above code into the site page (not in the popup) and it works. So it's something to do with it being dynamically loaded I think.
Any ideas?
Converting my comment to the answer :
Reason for $_GET['urlref'] not accessible in pop up might be an request which change the URL as well as $_GET. so you will able to access $_GET['urlref'] in Site Page but not in pop up.
So you can change your if condition in popup like below :
$url = $_SERVER['HTTP_REFERER'];
if (strpos($url,'urlref') !== false) {
echo 'urlref exists.';
} else {
echo 'No urlref.';
}
Let me know if you have any doubt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With