In Progress

Parsing value from one dropdown to another using content from mysql database

I have a registration form on RSForm component.

One of the fields is Estado (state). It is a dropdown populated with content that comes from a mysql table, where i use some code like that:

//<code>

$items = "|Selecione um estado";

$db =& JFactory::getDBO();

$db->setQuery("SELECT id_state, name_state FROM table_states ORDER BY name_state");

$result = $db->loadObjectList();

foreach ($result as $r)

$items .= "\n" . $r->id_state . '|' . $r->name_state;

return $items;

//</code>

There is another field which is a dropdown too, called Cidade (city). It must be filled according to what's selected by previous field (Estado). It must consult a mysql table too. The logic maybe something like that:

"SELECT id_city, id_from_state, name_city FROM table_cities ORDER BY name_city WHERE id_from_state='$some_var_id_state' "

Actually, my tests are on this page: [url removed, login to view]

It is kind of simple. But i'm not able to do it.

P.S.: I really NEED to make this form using RSForm and using mysql queries.

Skills: AJAX, Joomla, MySQL, PHP

See more: value city, mysql city state database, mysql dropdown, dropdown, database consult, dropdown select, rsform code, select dropdown, simple database ajax, form php ajax mysql, ajax return, ajax mysql table php, rsform component, rsform ajax, simple ajax order form, order database table form, state city dropdown php, mysql php state city, form ajax mysql, table content, rsform php database, ajax form mysql php, ajax order form php, php simple order database, parsing database mysql

About the Employer:
( 1 review ) Fortaleza, Brazil

Project ID: #2503669

Awarded to:

mrlonganh

Hi,I'm ready to help you now.

$45 USD in 1 day
(105 Reviews)
6.2

2 freelancers are bidding on average $45 for this job

tonekedwards

Your problem can easily be solved and will not take long at all. We may need to change the structure of the City table in your database. I have developed numerous similar drop downs previously.

$45 USD in 2 days
(2 Reviews)
3.8