Hello i have this code but there is a problem with preg_match on passing $pattern variable.
$pattern = htmlspecialchars($_POST['pregmatch']);
$pattern = "'".$pattern."'";
preg_match($pattern, $content, $m);
if i give this /<span class=\"product_title\">(.*)<\/span>/
in the $_POST[‘pregmatch’] pregmatch returns NULL.
If i change the code to this
//$pattern = htmlspecialchars($_POST['pregmatch']);
//$pattern = "'".$pattern."'";
preg_match('/<span class=\"product_title\">(.*)<\/span>/', $content, $m);
works like a charm.
So whats the deal here? Slashes creates this problem?
Thanks in advance.
Both of your additional lines appear to be causing a problem… if you were to do:
You would probably get the desired result.