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 :Let me know if you have any doubt.
If you want to load your
affiliate
variable dynamically then you need to store this variable insession
orcookie
:You just need to
set session
in your site page:Now you can get this
$_SESSION['urlref']
in you model page as well throughsession
.Maybe the hidden field that you want to add is not in the
<form>
tag, so that it is not sent to the server. Need more details with your problems (what’s plugin, HTML code,…)