SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Address list

  1. #1
    SitePoint Member
    Join Date
    Mar 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Address list

    Hello, I'm new to PHP. I have a simple database Address list: Name, Address, City, State, Zip, Phone. My field lists "City" & States are dropdown lists for list of cities in my state. My question is "How can I have users add their cities & States from other States then updates dropdown list? Do I need two tables "Add city" & "current city list"? I see this in MS Access database. Please help. Thank you.

  2. #2
    Kiwi Fr00t jylyn's Avatar
    Join Date
    Apr 2005
    Location
    New Zealand
    Posts
    218
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unless you use javascript you can't add anything onto the page the user is viewing without refreshing it.

    If you do this in PHP, you would have a text input "add city" and a submit button which would refresh the page and add the new city to the database at the same time, thus adding it to the drop-down list. You would also lose all the user's other input data and they would be very annoyed.

    If you were to use Javascript you could have a text input "add city" and anything the user typed into the text input could be automatically added to the drop-down list without refreshing. Then you could add the new city into the database once the whole form has been submitted. This I think would achieve what you're after but it's an unusual way of doing things and the user would probably be very confused about having to enter in a city AND select it from the drop-down list. Also I'm not sure you'd want random users coming along and adding fictional cities to your drop-down lists for other people to choose.

    What I would suggest you do is look at some other websites that do the kind of thing you're trying to achieve and take note of how they do it.

  3. #3
    SitePoint Member
    Join Date
    Mar 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the quick reply. Most other sites just has a field entry for the city list. I thought it be interesting for the users to try a dropdown list & if it's not listed to add their city. Maybe I'll just use a field list. Thanks again.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •