The mythical 
http://www.devmoz.com/blog/2007/04/04/cakephp-update-a-select-box-using-ajax/
seems exactly what you need.

On Feb 1, 2008 9:47 AM, Anna P <[EMAIL PROTECTED]> wrote:
>
> Hello!
> I'm wondering if anyone has any simple script or knows good tutorial
> about two dependent select tags.
> I use and understand a little of JS, but AJAX is too much for me.
> I just need this one functionality from AJAX - I have two tables:
> cities (id,name) and districts(id,city_id,name)
>
> I want to create two select tags:
>
> <select name="data[Profile][city_id]">
> <?php foreach($cities as $c):?>
> <option value="<?php echo $c['City']['id']?>"><?php echo $c['City']
> ['name']?></option>
> <?php endforeach;?>
> </select>
>
> <select name="data[Profile][district_id]">
> ..options with districts dependent from the chosen city...
> </select>
>
> Anyone please help...
> Can it be done like this... $cities are sorted by name, and when I
> enter on the registration page (this is where I need these two select
> tags), first select shows me first city from the $cities array and
> second select shows me districts of this city.
> Thank you in advance!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to