justinede Posted August 1, 2008 Share Posted August 1, 2008 Ok so I was working on this code for a friend and I ran into a problem. The first page, the user submits their email address. The second page, the email is added to a survey link as a subid. (ex. http://jptvjwg.com/click/?c=59065&s=31492&email=justin@justin.com) and the third page would be the survey with the email already being filled in by email. My friend wanted the cut out the middle step. So once the user hit submit when filling out their email address it goes to http://jptvjwg.com/click/?c=59065&s=31492&email=$email with the email already filled in. Here is what I have so far and it isnt working. Page 1 <form action="email.php" method="post"> <p> Email: <input name="email" type="text" id="email" /> </p> <p> <label> <input type="submit" name="button" id="button" value="Submit"> </label> </p> </form> Page 2 <?php Receiving variables @$email = addslashes($_POST['email']); header('Location: http://jptvjwg.com/click/?c=59065&s=31492&email=$email'); ?> Here is the code for the 3 step process. Page 1 is the same. And, Page 2 is: <?php // Receiving variables @$email = addslashes($_POST['email']); // echo"Complete each survey.<br> // You may have to use a different email for each survey.<br> // Also make sure you dont use your own email address.<br> // But the email that you choose has to be valid.<br> // ONLY FILL OUT THE FIRST PAGE (ex. email or zip).<br> // DONT USE YOUR CREDIT CARD FOR ANY OF THESE.<br><br>"; echo"<a href='http://jptvjwg.com/click/?c=59065&s=31492&email=$email' target='_new'>Survey</a><br>"; ?> If im not clear on what i want. Please post for more info. Thanks for any help. Quote Link to comment Share on other sites More sharing options...
bretticus Posted August 1, 2008 Share Posted August 1, 2008 That's because you are using single quotes in your header argument. Variables do not expand in single quotes, only double quotes. Thus, try <?php //Receiving variables @$email = addslashes($_POST['email']); header("Location: http://jptvjwg.com/click/?c=59065&s=31492&email=$email"); ?> Quote Link to comment Share on other sites More sharing options...
justinede Posted August 1, 2008 Author Share Posted August 1, 2008 lol wow. thanks! im so stupid. been puzzling at this for a while. thanks =P SOLVED Quote Link to comment Share on other sites More sharing options...
bretticus Posted August 1, 2008 Share Posted August 1, 2008 lol wow. thanks! im so stupid. been puzzling at this for a while. thanks =P SOLVED No, that is an easy mistake. Making mistakes is how you learn. Pardon the old cliche. FYI. You CAN use single quotes with variables but you have to use the concatenation operator (dot) Like .... <?php header('Location: http://jptvjwg.com/click/?c=59065&s=31492&email=' . $email); ?> By the way, I'm new to this forum, but there is probably a "resolve" link somewhere that you can mark this thread resolved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.