Getting PHP to ignore blank spaces and capitalization on a text field in a form?

David

New member
I've made a little progress but become stuck with some PHP code. I have a small database of codes, which I need a PHP form field to check against and then direct the visitor to one of two pages depending whether what they type into that field matches a record or not.

So far it works, but with a few problems, I'm looking to find out how to;

1. Get the PHP to ignore any spaces
2. Ignore any capitalization
3. Direct the visitor to seperate html pages

The page is here - http://www.bhurd.co.uk/test_checker.php

and the PHP which makes it work;

$postcodecheck = $_POST['postcode'];
$check = mysql_query("SELECT pc FROM ".$db_prefix."another WHERE pc = '$postcodecheck'")
or die(mysql_error());

$check2 = mysql_num_rows($check);
//if the PC exists it gives a message
if ($check2 != 0) {
die('That Postcode '.$_POST['postcode'].' is <strong class="highlight">eligible</strong> ');
}
elseif ($check2 == 0) {

print("<font color='#FF0000'>You are not eligible.</font>");
}
 
Back
Top