PDA

View Full Version : adding a php variable into a send mail <a href>



hey_suburbia
December 17th, 2009, 10:18 AM
I have a Flash game that allows you to drag MC's around and save their locations via URL query string. This works great except the string is 2 miles long...

The idea of the game is to "send to a friend" what you created. So I wrote up a simple PHP mailer. I can easily dump the giant URL into the mailer, but it's UGLY...

SO...

I went to be able to put the URL query string into a link that hides it's length.

I have had some experience with html in php mailers, but they were always seperate. ie

<body>

<?php>
code
?>

html stufff

<?php>
code
?>

</body>

What I'm trying to achieve is something to this effect:


$message = $_POST["longUrl"];

echo("Check out this Holiday Card I made for you: " . <a href=". $message . ">mydomain.com</a> ". ");

prasanthmj
December 17th, 2009, 11:18 PM
You have to compose an HTML email. The following page contains an example: PHP mail (http://php.net/manual/en/function.mail.php)

icio
December 18th, 2009, 09:16 AM
Alternatively you could create something similar to TinyURL (or even just use it) whereby you store the long-*** URL in a database with some ID number, and link to the ID number. Upon receiving a request for a specific ID your website would redirect to the given long url and viola.