Jump to content

[HELP] Variable in Url


justinede

Recommended Posts

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. :)

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.