url to form filling

Status
Not open for further replies.

Onedollaridea

Black Man
Apr 28, 2007
983
14
0
guys I need to know on how to fill a form using prepopulated by appending the information to strings onto the end of the link. i.e. &first=Michael&last=Johnson&email=michael@yahoo.com.

so basically when i email my users the creative's, I will include the url with the main details such as email, name etc and when they click on it and get to the landing page, everything should be filled, all they have to do it click submit.
 


In PHP You could use a variable with the $_POST info added to a variable and then simply output it where you want it.
For example:

<?php
// get your user info from the capture form
$email = $_POST["email"];
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];

$append = "&first=" . $firstname . "&last=" . $lastname . "&email=" . $email;
echo $append;
?>

Hope this helps.
 
If you are wanting the FORM on the LANDING PAGE to be filled in with the info you put in the URL the client will click on, then you would need to make something like the following:

At the top of the page:
<?php
# You want to use GET since you are passing the value on the URL.
# You also need to do some filtering to make sure to clean the data!
# Example not included for that...
$email = $_GET['email'];
?>

Where you have:
Email: <input type=text name=email>

You actually want to do:
Email: <input type=text name=email value="<?php echo $email; ?>">

Do that for each parameter you pass. Hope that helps.
 
Please don't forget to clean( ) Post and Get fields before using them in your code. I enjoy removing HTML entites, stripping slashes, and trimming my data before I use it.
 
Status
Not open for further replies.