Hey everyone,
I’m attempting to set up a site that has a single-field “signup for our email newsletter” form in the header that asks for your email address with a submit button. I’m not using the built in Mailing List module, I’m using a third party mail service that can collect more information than just the email.
So, when the visitor clicks “submit,” she gets taken to a expanded signup form with extra fields. The email field is already filled in to make this less of a pain for the visitor.
In EE1 I do this by passing the email string that the user types in through the URL. The original form has the method “link” and the action parameter is set to the URL of the signup page — /signup/index.
In EE1, clicking “submit” on the original form produces a URL like this and send the user to signup/index:
<a href="http://mysite.ca/signup/index?email_address=oxygensmith%">http://mysite.ca/signup/index?email_address=oxygensmith%</a> 40gmail.com(Note, there’s no space between the % and 40 in the original code, I have to put a space here to make “percent 40” not turn in to an @ sign.)
On signup/index, PHP (set to output) places the value from the URL into the email field (it cleans up the value for the at sign passed through the URL):
<?php
$querystring = $_SERVER['QUERY_STRING'];
$querystring_trimmed = str_replace("email_address=","", $querystring);
$querystring_touchedup = str_replace("% 40","@", $querystring_trimmed);
?>and the form is embedded via
{embed="_forms/.mailinglistform" emailadd="<?php echo $querystring_touchedup; ?>"}and in the embedded form, the variable is then added as the value of the email field:
<input type="text" class="title" name="MERGE0" id="MERGE0" size="25" value="{embed:emailadd}">
However, when I try this on EE2, I don’t even get as far as loading the next page. When EE2 is sent to a URL like
<a href="http://mysite.ca/signup/index?email_address=oxygensmith%">http://mysite.ca/signup/index?email_address=oxygensmith%</a> 40gmail.com...it throws a 404, sending me to the 404 page.
Does anyone have an alternate method of passing the variable, or a modification to this method, that will work?
Thanks!
Rob