deepson2 Posted October 16, 2009 Share Posted October 16, 2009 Hello, I want to display link on the page. i am fetching the data(URL) from database,actually before that i am checking if it is URL or not. if it is URL, let take an example google.com so it should take me directly on the Google's page after clicking on that link . but now the problem is the path is something like this. mydomain/myfolder/mysubfolder/google.com i want directly google.com Here is my code if($row['which_mail'] == "decline") { if(!preg_match("/^[a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+$/i",$row['content'])) { $ab = $row['content']; echo $ab ; // echo "<b>Last message for decline mail is</b>-".<a href='$ab'>".$row['content']."</a>."; echo "<a href='$ab'>".$row['content']."</a>"; }else{ $decline =$row['content']; echo "<b>Last message for decline mail is</b>- $decline"; }} Can anyone look into my code and tell me how can i achieve that? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/177877-solved-show-the-direct-link-into-href/ Share on other sites More sharing options...
deepson2 Posted October 16, 2009 Author Share Posted October 16, 2009 I have added "http" into it and now i am able to go the that particular link(google.com) echo "<b>Last message for decline mail is</b>-<a href='http://$ab'>".$row['content']."</a>"; but i want it show come like this www.google.com How can i get/add "www" into my url? Link to comment https://forums.phpfreaks.com/topic/177877-solved-show-the-direct-link-into-href/#findComment-937881 Share on other sites More sharing options...
deepson2 Posted October 16, 2009 Author Share Posted October 16, 2009 solved my problem. here is what i have done. $df ="www."; echo "<b>Last message for decline mail is</b>- ". "<a href='http://www.$content'>$df".$row['content']."</a>"; Hope this will help someone. Link to comment https://forums.phpfreaks.com/topic/177877-solved-show-the-direct-link-into-href/#findComment-937889 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.