Is there any way to make, using forms (textarea), text show like you type it, eg. a linebreak is shown like <br>?
I tried using <pre> but then it didn't use the space it had in the table, and it didn't break the line when crossing an image, which I would like it to do, is there any way to do this? Also, in the text, can you make some kind of link-sign that automatically changes it to <a href="$link">$linktext</a>? Like you can often write something like [link adress]linktext[/link]?
Thank you.
// HurraJag
Showing formatted text from forms
Moderator: General Moderators
Code: Select all
<?php
function parseurls($data){
$data = " ".$data;
$data = eregi_replace('([[]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'\\1<a href="http://\\2" target="_blank">\\2</a>', $data);
$data = eregi_replace('([[]()[{}])(http://[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'\\1<a href="\\2" target="_blank">\\2</a>', $data);
return trim($data);
}
?>it will turn any url to a link, no need forurl.