First you need to design the logic!
You could do this with one table or more, it really depends on how you want to do it! Using more than one table will help if your service get big!
But let me get you started with a simple setup!
Lets say you are using (1) table!
id auto incre... int 10
zip_postal vchar 7
city_place vchar 40
state_prov vchar 40
country_long vchar 60
country_short char 2
biz_type vchar 255
sec_type vchar 255
.... -> other stuff -> phone, addess, hours open and so on!
Now when your page loads, you just check if a request has been passed via a query or form process, if not load the default select boxes
- Code: Select all
if ( isset ( $_REQUEST['next'] ) )
// a request has been sent, load what the request wants!
// no request, load the default
This is a very basic way to do this!
Now the backend would look like this!
example for US states select box!
- Code: Select all
function state_box ()
$sd = "al,Alabama|ak,Alaska|az,Arizona|ar,Arkansas|as,American Samoa|ca,California|co,Colorado|ct,Connecticut|de,Delaware|dc,District of Columbia|fl,Florida|fm,FS of Micro|ga,Georgia|gu,Guam|hi,Hawaii|id,Idaho|il,Illinois|in,Indiana|ia,Iowa|ks,Kansas|ky,Kentucky|la,Louisiana|me,Maine|mp,Mariana Islands|mh,Marshall Islands|md,Maryland|ma,Massachusetts|mi,Michigan|mn,Minnesota|ms,Mississippi|mo,Missouri|mt,Montana|ne,Nebraska|nv,Nevada|nh,New Hampshire|nj,New Jersey|nm,New Mexico|ny,New York|nc,North Carolina|nd,North Dakota|oh,Ohio|ok,Oklahoma|or,Oregon|pw,Palau|pa,Pennsylvania|pr,Puerto Rico|ri,Rhode Island|sc,South Carolina|sd,South Dakota|tn,Tennessee|tx,Texas|ut,Utah|vt,Vermont|va,Virginia|vi,Virgin Islands|wa,Washington|wv,West Virginia|wi,Wisconsin|wy,Wyoming";
$ssd = explode ( '|', $sd );
$sbox = "<select name='sf' size='5'>";
for ( $i = 0; $i < sizeof ( $ssd ); $i++ )
$st = ( $i == '0' ) ? ' selected' : '';
$ops = explode ( ',', $ssd[$i] );
$sbox .= '<option value="' . $ops . '"' . $st . '> ' . $ops;
return ( $sbox . '</select>' );
I have some script examples that will show you how to do this in full detail, including the database lookups to the page output! Just PM me and I will give the scripts!
You can see an example here!
Click on the "Find Button" on any of these pages to see how the select box lookups work!