I have a form set up in asp using Dreamweaver with a text box for Zip, City, and State. I want a person to fill in zip and then when they move to the next field to have it fill in city and state. I also have a database called zipcodes and a table called zip with zip, city, state fields. Can anyone tell me how to do this. I have tried so many different things and just can't get it to work.
Hi ! I am new to it too.... so i am not sure , if i'll really be able to help you out.. but here's what i can make of it...
you can store the zip in a variable by
strzip =<%form.request("zip") %> where zip is the name of the text box which gets the zip value
next you create a connection object
and then you create the record set
<%dim recordset1
set recordset1 = Server.CreateObject("ADODB.RecordSet")
recordset1.open "zipcodes" , <connection string>
' now we use the filter collection to filter the recordset according to your pin
recordset1.filter = " zip = strzip " %>
'here zip is the field in the table
<input type = "text" value =<%response.write("recordset1.fields("city")" name="text1")
<input type = "text" value =<%response.write("recordset1.fields("state")" name="text2")
<%recordset1.close
set recordset1 = nothing %>
I hope it helps... let me know ..