I am passing restaurant types which include, for example:
Pizza
Other - Dining
Cajun/Creole
On the linking page I am re-writing the above to:
Pizza
Other%20-%20Dining
Cajun_Creole
The data I get is exactly what I sent, except for the %20s, which turn back into spaces.
So I thought I could do something like this:
Code: Select all
$category = $_GET['category'];
$good_chars = '/[a-zA-Z0-9]/';
if (preg_match($good_chars,$category)) {
print $category . " has bad characters in it.";
}
else {
print $category . " has no bad characters.";
}
I thought maybe I had it backwards, so I put a ! in front of preg_match, but that resulted in 100% acceptance of the strings.
I'm obviously missing something and I don't know what... knowing WHY would be even more helpful.
Any assistance at all is greatly appreciated.