Menu
I have this guestbook that I made. One of the fields is a home page field. On the display page I want to take the url they type and make it an actual link so that when you click on it you go to their site. I would also like to do that for their email. Here is the url so you can see what I’m trying to do.
[url]http://vulcan.resourceforge.com/~rtcstudent/mattdudley/madddisplay.php
my site:
[url]www.madddidley.com
[upl-file uuid=989df73c-ab6a-4bb9-96d6-cb5453f82761 size=7kB]girlpromo.jpg
[code=php]
preg_replace("/(.@\W\.[a-zA-z])/", "<a href="mailto:$1">$1</a>");
[/code]
[i]Originally posted by Jona [/i]Might want to try testing that one. ?
[B]here's an email one--untested:[/B][/QUOTE]
[i]Originally posted by pyro [/i]
[B]Might want to try testing that one. ? [/B][/QUOTE]
[code=php]
$email = preg_replace("/(.+@[a-zA-z]*.[a-zA-z]{3})/", "<a href="mailto:$1">$1</a>", $_POST["email"]);
[/code]
[code=php]<?php
$query="select * from madddidley order by 'time'";
$result=mysql_query($query);
echo mysql_error();
while($e=mysql_fetch_array($result))
{
echo "
<div class="date">Time: ".$e['time']."</div>
<div class="date">Name: ".$e['name']."</div>
<div class="date">Email: <a href="".$e['email']."">".$e['email']."</a></div>
<div class="date">Homepage: ".$e['homepage']."</div>
<div class="date">Comments: ".$e['comments']."</div>
<hr color=#FFFFFF width=100%>";
}
?>[/code]
[i]Originally posted by pyro [/i]
[B][a-zA-z] should be [a-zA-[b]Z[/b]][/B][/QUOTE]
[code=php]
$email = preg_replace("/(.+@[a-zA-Z]*(.[a-zA-Z]{2,}){1,})/", "<a href="mailto:$1">$1</a>", $_POST["email"]);
echo("Email: ". $email ."<br>");
$site = preg_replace("/((ht|ft)tp(s)?://(www.)?[a-zA-Z]+(.[a-zA-Z]{2,}){1,}(/)?)/", "<a href="$1">$1</a>", $_POST["site"]);
echo("Site: ". $site);
[/code]
[i]Originally posted by madddidley [/i]
[B]I'm sorry..............I don't understand [/B][/QUOTE]
[code=php]
$site = preg_replace("/((http|ftp)(s)?\:\/\/)?((www\.)?[a-zA-Z]+(\.[a-zA-Z]{2,}){1,}(\/)?)/", "<a href="http://$4">$1$4</a>", $_POST["site"]);
[/code]
<?PHP
$str = '&#91;b&#93;this&#91;/b&#93; is &#91;b&#93;bold&#91;/b&#93;';
$str = preg_replace("/[b](.*)[/b]/", "<strong>$1</strong>", $str);
echo $str;
?>
<?PHP
$str = '&#91;b&#93;this&#91;/b&#93; is &#91;b&#93;bold&#91;/b&#93;';
$str = preg_replace("/[b](.*[color=firebrick][b]?[/b][/color])[/b]/", "<strong>$1</strong>", $str);
echo $str;
?>
[i]Originally posted by Jona [/i]It has something to do with it, because in your case, you weren't "validating an email address" where you could (maybe!) assume that only one address would be passed. You were trying to parse a string and turn the addresses to links.
[B]Uh, and what does the bold example have to do with validating an email address?[/B][/QUOTE]
[i]Originally posted by pyro [/i]
[B]It has something to do with it, because in your case, you weren't "validating an email address" where you could (maybe!) assume that only one address would be passed. You were trying to parse a string and turn the addresses to links. [/B][/QUOTE]
0.1.9 — BETA 5.17