Question: I am trying to work on a fansite for a game, and i've ran into an issue. I have an html textarea, that a user can put in a bio of themselves, or an about me in other terms. I am wondering how if a user types in a link for example google.com how that can post to my database, and then appear as a clickable link that when clicked will take someone to whatever link is put in there. So if someone types google.com, it will lead to google.com when clicked. If someone puts in facebook.com, it will take them to facebook.com when clicked, etc. 

So how can I make it so links are clickable without having to put in an a href? This is all I have so far, because I don't know where to go from here.

Textarea code:

```
<tr>
    <td class="style7"><div align="right">Bio:</div></td>
    <td><textarea name="bio" cols="42" rows="8" id="bio"><?php echo "$bio"; ?></textarea></td>
</tr>

```

Some php:

```
 $bio = $_POST['bio'];

```

Post into database:

```
$sql = mysql_query("UPDATE members SET email='$email', password='$password', country='$country', bio='$bio' WHERE id='$id'"); 

```

Any help would be much appreciated!

Answer: 
A nice way to achieve what you want with adding a layer of security is by using BBCode tags.

There is a full documentation on [BBCode on the PHP.net webiste](http://www.php.net/manual/en/book.bbcode.php), or a [simple BBCode parser available in a single file here](http://forrst.com/posts/Simple_PHP_BBCode_Parser-N0z).

It will be easy to convert links to clickable text like this:

```
$safe_html = bbcodeParser($bio);

```

And then add this $safe\_html into the database.

Or instead of a textarea, put a single line input accepting only URLS (checking with regular expressions as the other answers suggests).

Still, there are lots of other security loopholes to consider in the code you posted ! Be careful !
There is a set of solutions for your problem

* the user input can be an html link (not a good idea: injection)
* the user leaves a bare string that resembles a url
* the user leaves a specially formatted url like stackoverflow does `[url](metaData)`

Let's focus on some considerations

* save the data formatted ready for output (bad idea)
* save the data just like the user passed it (after filtering it) and prep your output functions to process the content

Some tools at your disposal

* ***RegularExpressions***, ***RegularExpressions***, and some more ***RegularExpressions***

Please take your time to understand what's underlying your problem, then come back and ask to your hearts content