URL question :/

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

URL question :/

Post by qads »

how would i turn a url e.g. http://www.somesite.com in to click-ble link?
btw, i am useing a text box whoes value is inseted into mysql db when submitted..

thanks for your time and help...
User avatar
gotDNS
Forum Contributor
Posts: 217
Joined: Tue May 07, 2002 5:53 pm
Location: West Chester, PA

Post by gotDNS »

I think i could help if i understood what u were asking.....what do u mean
how would i turn a url e.g. http://www.somesite.com in to click-ble link?
A tag? lol.

If u mean that is getting iserted into a DB through a textbox, just make sure u allow the A tag and...yeah...

That probably, in no way, answers ur question..cuz i don't understand it.....what did u mean?
User avatar
gotDNS
Forum Contributor
Posts: 217
Joined: Tue May 07, 2002 5:53 pm
Location: West Chester, PA

Post by gotDNS »

OK, i think I might get it.....in a TEXTAREA this is going? If so...you could somehow STRSTR for lie.."www"....eh..i dunno
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

Code: Select all

function parseurls($data){
   $data = " ".$data;

   $data = eregi_replace('(її:space:]()ї{}])(www.ї-a-zA-Z0-9@:%_\+.~#?&//=]+)',
   '\\1<a href="http://\\2" target="_blank">\\2</a>', $data);

   $data = eregi_replace('(&#1111;&#1111;:space:]()&#1111;&#123;&#125;])(http://&#1111;-a-zA-Z0-9@:%_\+.~#?&//=]+)',
  '\\1<a href="\\2" target="_blank">\\2</a>', $data); 

   return trim($data);
&#125;
if a url is in $data, it will be changed to a link
User avatar
gotDNS
Forum Contributor
Posts: 217
Joined: Tue May 07, 2002 5:53 pm
Location: West Chester, PA

Post by gotDNS »

....right...u take it hob_goblin...lol
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

lol, sorry guys, i was in a hurry, i did't even read it after posting :roll: but thanks...
Post Reply