Forum Moderators: coopster
I am getting information from an html form to my php page and then sending it as an E-Mail as well. I have a textbox in my form where users enter E-Mails to their website. When my E-Mail gets sent to myself, I would like it so each line has a link of itself, so it would be:
[google.com...]
[facebook.com...]
this would have to be replaced with
<a href="http://www.google.com">http://www.google.com</a>
<a href="http://www.facebook.com">http://www.facebook.com</a>
This is what I have so far:
$links = nl2br($links);
$strHeaders = "MIME-Version: 1.0\r\n";
$strHeaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
$all = "<font face='Arial' color='blue' size='3'><b>2007 Contest</b></font></p>
<html><body><font face='Arial' size='3'>Category: <b>$category </b><br>
<b>$division</b><br><br>
Name of location: <b>$location</b> <br>
Name of submitter: <b>$submitter</b> <br>
Title of submitter: <b>$titlesubmitter</b> <br><br>
Nominee(s): <b>$nominee</b> <br><br>
Publication date(s): <b>$pubdate</b> <br><br>
Links of content: <b>$links</b> <br><br>
Comments: <b>$comments</b></font></body></html>";
mail('dummyemail@gmail.com,$location . " Entry",$all,$strHeaders, "email@gmail.com");
Help is much appriciated, thank you!
[edited by: Vipor at 8:17 pm (utc) on Dec. 12, 2007]
Something like -
//$input = $_POST['links'];
$input = "http://www.google.com\nyahoo.co.uk,www.msn.com\n";
$pattern = '%[^\w\.:/]%is';
$split = preg_split($pattern, $input, -1, PREG_SPLIT_NO_EMPTY);
echo '<pre>';
print_r($split);
echo '</pre>';