19edie68 Posted October 28, 2015 Share Posted October 28, 2015 (edited) First of all, I apologize for not knowing all the technical terms. The code below is what I'm using to write to a file which is then shown on a very simple chat I've made. I want URL's to automatically be converted to clickable hyperlinks. I've found many snippets of code to make this happen but have no idea how to implement them into my code or which one is the right choice. Thanks for any help <?php if (isset($_POST["submit"]) && $_POST["message"] != "") { date_default_timezone_set("America/Los_Angeles"); $txt = " <span class=\"date\">Captain's Log - Stardate: ". date("njy @ giA") ."</span><br/>" . stripslashes(nl2br($_POST["message"])) . "<br/>" . "<div class=\"line\"></div> "; $file_data = "$txt"; $file_data .= file_get_contents('txt.txt'); file_put_contents('txt.txt', $file_data); } ?> Edited October 28, 2015 by 19edie68 Quote Link to comment https://forums.phpfreaks.com/topic/298888-make-urls-clickable-hyperlinks/ Share on other sites More sharing options...
ginerjm Posted October 28, 2015 Share Posted October 28, 2015 Uh - what urls? Quote Link to comment https://forums.phpfreaks.com/topic/298888-make-urls-clickable-hyperlinks/#findComment-1524590 Share on other sites More sharing options...
19edie68 Posted October 28, 2015 Author Share Posted October 28, 2015 What do you mean what are URL's ginerjm? Quote Link to comment https://forums.phpfreaks.com/topic/298888-make-urls-clickable-hyperlinks/#findComment-1524593 Share on other sites More sharing options...
ginerjm Posted October 28, 2015 Share Posted October 28, 2015 ?? I said "What URLs". You aren't showing any urls in your example, so I'm confused as to what you want to work on. Quote Link to comment https://forums.phpfreaks.com/topic/298888-make-urls-clickable-hyperlinks/#findComment-1524595 Share on other sites More sharing options...
QuickOldCar Posted October 28, 2015 Share Posted October 28, 2015 preg_replace using regex for url patterns Quote Link to comment https://forums.phpfreaks.com/topic/298888-make-urls-clickable-hyperlinks/#findComment-1524615 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.