How can I check if text in PHP contains a link in it's text? I have a database table format as follow.
+------------------+
| id | posts | tag |
+------------------+
| 1 | text 1| 0 | //no links
| 2 | text 2| 1 | //contains links
Basically, I want to verify that the submitted entry contains a link, if it does,
the tag
column will have a value of 1
.
Can someone help me to properly code the above sample? Currently this is my PHP:
include 'function.php';
$text= $_POST['text'];
//if $text contains a url then do this function
postEntryWithUrl($text);
//else here
postEntry($text);