Jump to content

Using a function


master82

Recommended Posts

I have created the following function in function.php

 

<?php
function igm($text)
{
//remove links
$text = preg_replace("#www\.(.+?)\.com#is", "link here removed", $text);
//remove unwanted characters
$text = preg_replace("/[^a-zA-Z0-9.!?, ]/", "", $text);
return $text;
}
?>

 

I then want to use this function on a user input before it is stored in the database, so I am doing the following...

 

<?php
include("function.php");
igm($_POST['userinputfield']);
mysql_query("insert here");
?>

 

However it doesnt seem to be working, any idea why not or advice?

 

Thanks :)

Link to comment
https://forums.phpfreaks.com/topic/54766-using-a-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.