Re: Form Validation Issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kvigor wrote:
if($value != 'Alabama' || $value!= 'AL' || $value != 'Alaska' || $value!= 'AK' || $value != 'Arizona' || $value!= 'AZ' || $value != 'Arkansas' || $value!= 'AR' || $value != 'California' || $value!= 'CA' || $value != 'Colorado' || $value!= 'CO' || $value != 'Conneticut' || $value!= 'CT' || $value != 'Delaware' || $value!= 'DE' || $value != 'Florida' || $value!= 'FL' || $value != 'Georgia' || $value!= 'GA' || $value != 'Hawaii' || $value!= 'HI' || $value != 'Idaho' || $value!= 'ID' || $value != 'Illinois' || $value!= 'IL' || $value != 'Inidiana' || $value!= 'IN' || $value != 'Iowa' || $value!= 'IA' || $value != 'Kansas' || $value!= 'KS' || $value != 'Kentucky' || $value!= 'KY' || $value != 'Louisiana' || $value!= 'LA' || $value != 'Maine' || $value!= 'ME' || $value != 'Maryland' || $value!= 'MD' || $value != 'Massachusetts' || $value!= 'MA' || $value != 'Michigan' || $value!= 'MI' || $value != 'Minnesota' || $value!= 'MN' || $value != 'Mississippi' || $value!= 'MS' || $value != 'Missouri' || $value!= 'MO' || $value != 'Montana' || $value!= 'MT' || $value != 'Nebraska' || $value!= 'NE' || $value != 'Nevada' || $value!= 'NV' || $value != 'New Hampshire' || $value!= 'NH' || $value != 'New Jersey' || $value!= 'NJ' || $value != 'New Mexico' || $value!= 'NM' || $value != 'New York' || $value!= 'NY' || $value != 'North Carolina' || $value!= 'NC' || $value != 'North Dakota' || $value!= 'ND' || $value != 'Ohio' || $value!= 'OH' || $value != 'Oklahoma' || $value!= 'OK' || $value != 'Oregon' || $value!= 'OR' || $value != 'Pennsylvania' || $value!= 'PA' || $value != 'Rhode Island' || $value!= 'RI' || $value != 'South Carolina' || $value!= 'SC' || $value != 'South Dakota' || $value!= 'SD' || $value != 'Tennesee' || $value!= 'TN' || $value != 'Texas' || $value!= 'TX' || $value != 'Utah' || $value!= 'UT' || $value != 'Vermont' || $value!= 'VT' || $value != 'Virginia' || $value!= 'VA' || $value != 'Washington' || $value!= 'WA' || $value != 'West Virginia' ||$value!= 'WV' || $value != 'Wisconsin' || $value!= 'WI' || $value != 'Wyoming' || $value!= 'WY') //if they don't the match these

Ok, here is something that might help you.

$states['AL'] => 'Alabama';
$states['AK'] => 'Alaska';
$states['AZ'] => 'Arizona';
$states['AR'] => 'Arkansas';
$states['CA'] => 'California';
$states['CO'] => 'Colorado';
$states['CT'] => 'Conneticut';
$states['DE'] => 'Delaware';
$states['FL'] => 'Florida';
$states['GA'] => 'Georgia';
$states['HI'] => 'Hawaii';
$states['ID'] => 'Idaho';
$states['IL'] => 'Illinois';
$states['IN'] => 'Inidiana';
$states['IA'] => 'Iowa';
$states['KS'] => 'Kansas';
$states['KY'] => 'Kentucky';
$states['LA'] => 'Louisiana';
$states['ME'] => 'Maine';
$states['MD'] => 'Maryland';
$states['MA'] => 'Massachusetts';
$states['MI'] => 'Michigan';
$states['MN'] => 'Minnesota';
$states['MS'] => 'Mississippi';
$states['MO'] => 'Missouri';
$states['MT'] => 'Montana';
$states['NE'] => 'Nebraska';
$states['NV'] => 'Nevada';
$states['NH'] => 'New Hampshire';
$states['NJ'] => 'New Jersey';
$states['NM'] => 'New Mexico';
$states['NY'] => 'New York';
$states['NC'] => 'North Carolina';
$states['ND'] => 'North Dakota';
$states['OH'] => 'Ohio';
$states['OK'] => 'Oklahoma';
$states['OR'] => 'Oregon';
$states['PA'] => 'Pennsylvania';
$states['RI'] => 'Rhode Island';
$states['SC'] => 'South Carolina';
$states['SD'] => 'South Dakota';
$states['TN'] => 'Tennesee';
$states['TX'] => 'Texas';
$states['UT'] => 'Utah';
$states['VT'] => 'Vermont';
$states['VA'] => 'Virginia';
$states['WA'] => 'Washington';
$states['WV'] => 'West Virginia';
$states['WI'] => 'Wisconsin';
$states['WY'] => 'Wyoming';

now use this like this

if ( !isset($states[$value]) && !in_array($value, $states) ) {
	// do something because I can't find the state
}

use something like this so your logical errors will be reduced

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Unknown

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux