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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.