|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
passing vars from email to form
I want to make my mailshots a bit more clever for my customers. Basically, I send a mailshot once or twice a month to all names in my database. The customer then RSVP's by clicking the "Yes" or "No" links.
When they click these links, they are presented with a form on my web page. As all the customers details are in my database, how can I set the process up to automatically fill in as many of the boxes as possible when they click the link? (Such as email address, postal address etc...) I'm fine with querying the DB, I just need to know how to pass the vars to the form from the email. |
|
#2
|
|||
|
|||
|
RE: passing vars from email to form
Are you looking for something like this:
// get vars from database $name = ...(whatever you use to get data from a database) etc... <form> <input type=text name=name value="<?php print $name ?>"> </form> |
|
#3
|
|||
|
|||
|
RE: passing vars from email to form
What I am looking for is storing data in a hidden field or as part of the link within the email message received by customers.
My web page displays a form, on the the fields is named email. When the user clicks the link within the email, the field $email is passed thru to my form and inputted into the email field. I could then use the value to query the database and get the rest of the users details. I have tried using http://mysite.com/yes?email=someone@somewhere.com but it doesn't work. |
|
#4
|
|||
|
|||
|
RE: passing vars from email to form
If you use this in php version 4.1 or later you shoul be able to use
$_GET['email'] to do your db query else use $HTTP_GET_VARS['email'] |
|
#5
|
|||
|
|||
|
RE: passing vars from email to form
you could also embed the db unique id for the user (same concept as using the email)in the url sent to the user, then the form page would use that var "id" to query the db, get the info to prefill the form.
|
|
#6
|
|||||
|
|||||
|
RE: passing vars from email to form
I tried this...
php Code:
The link within the email simply reads <a href="http://mysite.com?uid=261">Click here</a> but the field remains blank. What am I doing wrong? |
|
#7
|
|||
|
|||
|
RE: passing vars from email to form
can you call $_GET within a function? maybe you need to declare it as global first.
|
|
#8
|
|||
|
|||
|
RE: passing vars from email to form
$_GET is a superglobal...no need to declare it global.
Are you sure you are using php version 4.1.0 or higher? If not, use $HTTP_GET_VARS['uid'] and you will need to place global $HTTP_GET_VARS; at the top of your script.... Try echoing out both $HTTP_GET_VARS['uid'] and $_GET['uid'] in your function and seeing if they have values... Also, $PHP_SELF probably isn't going work inside the function. You will need to place a global $PHP_SELF; at the top of the function to make it work.... |
|
#9
|
|||
|
|||
|
RE: passing vars from email to form
are you sure $row contains data
try print_r($row) |
|
#10
|
|||
|
|||
|
RE: passing vars from email to form
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > passing vars from email to form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|