Need help storing variable in table
Hi,
With my WADA Insert, Update & WASA Profile pages I would like to store a field in the database based on a field in the form.
From the two digit State entered on the form I would like a Region field in the database table updated. Might I be able to select this Region from a short list of arrays such as…
<?php
$eastern = array('CT', 'DE', 'DC', 'ME', 'MD', 'MA', 'NH', 'NJ', 'NY', 'PA', 'RI', 'VT', 'QC', 'NL', 'PE', 'NS', 'NB');
$southern = array('AL', 'FL', 'GA', 'LA', 'MS', 'NC', 'SC', 'VA', 'WV');
$central = array('IL', 'IN', 'KY', 'MI', 'OH', 'TN', 'WI', 'ON');
$great_plains = array('AR', 'CO', 'IA', 'KS', 'MN', 'MO', 'MT', 'NE', 'NM', 'ND', 'OK', 'SD', 'TX', 'WY', 'MB', 'SK', 'NT');
$western = array('AK', 'AZ', 'CA', 'HI', 'ID', 'NV', 'OR', 'UT', 'WA', 'AB', 'BC', 'YT');
if (in_array($row_WAATKmemberaccounts['State'],$eastern))
$region = 'Eastern';
elseif (in_array($row_WAATKmemberaccounts['State'],$southern))
$region = 'Southern';
elseif (in_array($row_WAATKmemberaccounts['State'],$central))
$region = 'Central';
elseif (in_array($row_WAATKmemberaccounts['State'],$great_plains))
$region = 'Great Plains';
elseif (in_array($row_WAATKmemberaccounts['State'],$western))
$region = 'Western';
else
$region = 'International';
?>
Does the above code look correct/usable?
But now I don’t know how to get my variable $region stored into the table field labeled Region.
Your help would be appreciated
Note: this question is similiar to my post post #118796 however I dodn't have the skills to adapt the suggested tutorial.
Thanks,
Dennis