Jump to content

undefined function preg_match()


perrij3

Recommended Posts

I have used the same code for a contact page on several website. I have used it on 2 different web hosting servers. I am trying to set up a contact form on a different web hosting company server and get the following message:

Fatal error: Call to undefined function preg_match() in /home/html/contact_us.php on line 38

 

Is there a setting in the php.ini file that I would need to change?

 

This is the code around line 38:

 

	//if the variable is an array, loop through each element
//and pass it recursively back to the same function
if (is_array($val)) {
	foreach ($val as $item) {
		isSuspect($item, $pattern, $suspect);
		}
	}	
else {
	//if one of the suspect phrases is found, set Boolean to true
	if (preg_match($pattern, $val)) {
		$suspect = true;
		}
	}
}

 

line 38 is this line: if (preg_match($pattern, $val)) {

 

The version of php on this new server is php 5.2.1. I have used echo '<pre>'.print_r($_POST, true).'</pre>'; to see if the data was being posted and it is.

 

Does anyone know why I am getting this message on one server and not the other?  Thanks for your help in advance. :)

Link to comment
https://forums.phpfreaks.com/topic/172912-undefined-function-preg_match/
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.