Re: [PHP] jquery fill select option value

[email protected] (Tedd Sperling)
Newsgroups php.general
Message-ID <[email protected]>
On Sep 21, 2013, at 9:06 PM, iccsi <[email protected]> wrote:
> <select id="mark" name="mark">
> <option value="">--</option>
> <option value="bmw">BMW</option>
> <option value="audi">Audi</option>
> </select>
> 
> I use above code to have my select drop down on the form and would like to use jQuery to fill option value on change event.
> I would like know is it possible to do, if yes, any hint or example code at server site is appreciated,
> 
> Your help and information is great appreciated,

While jQuery is great, you don't need jQuery for this -- a simple AJAX routine will do what you want. Here's an example:

http://php1.net/a/zipcode-states/

The ajax routine is there -- you can copy it.

The HTML is there -- you can copy that too.

The php script is a simple script that is triggered by an ajax script (triggered by the user via onchange() ) that then pulls whatever data is needed to populate the remaining option controls via a GET.

HTH's 

tedd

_______________
tedd sperling
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.