show the direct link into href


Posted on 16th Feb 2014 07:03 pm by admin

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.

Quote mydomain/myfolder/mysubfolder/google.com
i want directly

Quote google.com
Here is my code

Code: [Select]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.

No comments posted yet

Your Answer:

Login to answer
187 Like 19 Dislike
Previous forums Next forums
Other forums

PHP, Arrays & A Lot Of Confusion
I've been doing basic PHP work on sites for a few years now, but I've never been tempted to learn ho

Wierd echo error?
Hi, i got the most wierd php error ever and i don't know why..
Code: echo "<t

Creating a db with a query
Hello everyone.
I'm having troubles creating a db with a query.
I'm reading a book called PHP

Hit counter updating once per IP - IP HIT COUNTER
I have a hit counter, for the amount of views on a tutorial.
It'll do the query and then do..

How can use this array as a key?
Say I have this array for example:


print_r($array);

Prints:
Code: [Select]Array

Typing math
I've added support for typesetting math using LaTeX on the forums.

Example:
Code: [Select]

how to load a Sys file with system load and call images?
normally you need register the module as a service with CreateService, and start the service

extract data
Code: <div class="post hentry uncustomized-post-template">

Simple MySQL script is not working
Hey guys,

Just familiarizing myself with PHP and MySQL. I am following along in the O'Reilly

Guixt issue
Hello all,

We are experiencing the following problem with Guixt:

Some transact

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash