0

On my site, people can link to topics with buttons I made. Those buttons are putting out a (look: http://....) or (look: (link without http://) on the textarea and when they submit it, the hyperlink shows in their post. That is very nice, but if I fetch this data to show them their last posts, I don't get the hyperlink, but just the plain text. So (look: http://....) does not lead to a link...

I have seen in phpmyadmin that it is stored as plain text, so I can understand that, but how can I make those things hyperlinks and the rest of the text (the no-links) just plain?

user1814289
  • 21
  • 1
  • 3
  • 11

2 Answers2

0

Try using htmlentities to convert those hyperlinks before saving them in your database. You can then use html_entity_decode when getting the data from the database.

Amir Syafrudin
  • 853
  • 8
  • 15
0

Please take into account the aforementioned comments about security issues. You have to sanitize data the user inputed data before you further process the data.

To answer your question. Store the links in a separate column of your table. Then fletch your links to the user via PHP - I guess you are using MySQL in combination with PHP - like you do with the posts. If you want to create a link you need to use the anchor HTML tag. E.g. <a href="http://yourlink">Name link</a>.

Mr. Radical
  • 1,847
  • 1
  • 19
  • 29