Forum Moderators: coopster

Message Too Old, No Replies

Creating a Link

Creating a Link from data called from a database

         

imtrypin

8:52 am on Jun 7, 2008 (gmt 0)

10+ Year Member



Howdy folks.

Here is what I am trying to do (very unsuccessfully I might add!), I have a database that is populated from forms. On one form the user inputs their email address. I have another page where the user's contact information is displayed. I would like to be able to create a link using the user's email address from the returned data on the contact info page that when clicked will take me straight to my email page while carrying forward the user's email address.

Jeez...I hope that makes sense. If anyone can help I will greatly appreciate it.

Thank you.

wheelie34

12:08 pm on Jun 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi try this

call the data from the database

$sql="select * from table";
$result = mysql_query($sql, $dblink) or die("System down");
while ($newArray = mysql_fetch_array($result)){
$emailaddy = $newArray['emailaddy'];
echo "<a href=\"page.php?emailaddy=$emailaddy\">Link</a>";
}

then on the page you want the email to be sent from


$emailaddy = $_GET['emailaddy']; #you may want to clean it here
print "<a href=\"mailto:$emailaddy\">Send the email</a>";

Obviousley I havent tested it but it should give you an idea of how to collect and move the addresses around your pages etc