Need QUICK help from anyone with PHP knowledge!!!

by 6 replies
7
I have a problem that needs solving. I need you to take a look at my code.
pm me!!!
#programming #knowledge #php #quick
  • Could you be more specific about what you need help with?

    Joe Crosbie,
  • [DELETED]
  • If your code is short, post it here, if its more than a dozen lines of so post it on pastebin.com and give us the pastebin link and someone might help you.
  • Banned
    [DELETED]
  • I solved all my problems except for 1.

    I created down downs for country, province, city. I can get the data from mysql database and even post the data back into the database. This all works perfectly. However, to turn these drop downs into dynamic dropdowns, I need the help of javascript. The tutorials i looked at helped me create a dynamic drop down with javascript. But if i use that method, i can not use a query to upload data into the database.

    So what would be the solution to this?
    • [1] reply
  • Well, using your script above to create the dropdowns, you can tell which city/country has been selected when the form is submitted from the $_POST data, then you can do whatever you want with the data, such as insert it into your customer order table etc.

    If you are going to populate the dropdowns from the database using AJAX, you need to store a relationship between the country/province/city/

    Eg:
    table cities:

    id
    name
    province_id

    table provinces

    id
    name
    country_id

    table countries

    id
    name


    That way, when you select a country in the dropdown, you would use ajax to call a script that loads all the provinces from the provinces table with the selected country_id, and populates your second dropdown.

    Then, when they select the province, you would do another ajax call to populate the final dropdown from the cities table, selecting all cities with the selected province_id.

    Then, when the form submits, you have a value for the country, province and city in the post data.

    Does that answer your question?

Next Topics on Trending Feed