I am trying to assign an html link as the value of a php variable. Like so, (which I know doesn't work):
$mlink = <a href = "download.php">Download Link</a>;
I am trying to send an email with a link as the message of the email. I am using mail() to do so. Here is my code for the script which sends the mail. This is where I want to use the $mlink variable that has the html link as its value.
<?php
$to = $_POST['email1'];
$subject = "Test mail";
$message = $mlink;
$from = "somewhere@somewhere.com";
$headers = "From:" . $from;
if( mail($to, $subject, $message, $headers) )
{
echo ("<p>Mail Sent!</p>");
}
else
{
echo ("<p>Mail could not be sent!</p>");
}
?>
I am assigning the value of $mlink within another script that calls on this one. I can post that script as well. I just wasn't sure if that was necessary.
I can't seem to figure out how to get this to work. I've tried to use echo but it gives me an error when I do so in a variable assignment statement. I've tried a few other things but they all either give me an error or unwanted output. I am at a loss as to how to make this work :(
Any help is greatly appreciated. Thanks in advance for any enlightenment!