I have two tables.
1:zipcode with fields zipID (primary key),Zipcode,cityID
2:cityname with fields cityID (primary key),cityname
I wish to have a text field on my form that allows for entry of zipcode and either returns ‘not found’ or returns a selectable listbox of matching cities for the zipcode.
I know how to obtain the city names into an array using sc_lookup and the variable returned by the text field but do not know how to present the listbox on screen.
-------------------->>>>>>
ajax event zipcode ‘On Change’
sc_lookup(citydata,“SELECT zipCode,cityName FROM us_Zipcodes,us_Cities WHERE us_Cities.cityID = us_zipCodes.cityID AND zipCode=’{zipCode}’)”);
if ({citydata} === false)
{
echo “Access error. Message=”. {my_data_erro} ." Call Administrator" ;
}
elseif (empty({citydata}))
{
echo “No such zipcode”;
}
else
{
// how do I place results from cityData array into a listbox and place on the form.
// !!!This is where I need help - need to create a listbox for selection of city names if more than 1 found
;
}