master82 Posted June 8, 2007 Share Posted June 8, 2007 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 More sharing options...
per1os Posted June 8, 2007 Share Posted June 8, 2007 <?php include("function.php"); $userinputfield = igm($_POST['userinputfield']); mysql_query("insert here"); ?> Setting a variable to the return value might help. Link to comment https://forums.phpfreaks.com/topic/54766-using-a-function/#findComment-270837 Share on other sites More sharing options...
master82 Posted June 8, 2007 Author Share Posted June 8, 2007 lol Simple things.... Thanks! Link to comment https://forums.phpfreaks.com/topic/54766-using-a-function/#findComment-270838 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.