There are several ways of doing it and all involve javascript, some more
than others.  Here are some of the problems;
. without javascript the only thing that will cause a form to be submitted
to the server for rebuilding, is clicking a submit button.
. with a minimal amount of javascript you can cause the form to be submitted
to the server when an item is selected from the first pulldown box.
. with javascript and javascript arrays, you can cause one list to "cascade"
to the next without going to the server (maybe).

On your first list if you code something like the following;
<select name="firstsel" onChange="this.form.submit();">
....
Note: the code inside the onChange quotes is actually javascript, but it is
rather minimal, don't you think.

When your form is submitted form variable "firstsel" will have a value, base
on that you can send back to the browser the same form, with the firstsel
list with one item selected, and the filled in second dependent list.
This technique requires a round trip to the server and back for each
selection and is not the best of user experiences, but sometimes it is all
you can do.

Javascript is not too painful, and I would encourage plagerism while you are
learning it.  You can eventually avoid sending the entire form to the server
and retrieving an entire refresh of the page by using AJAX, but even there a
round trip to the server is required (just not the entire form).

You can find lots of useful scripts at http://www.hotscripts.com in their
javascript section, a good place to see different techniques.  Also Google
can be your friend.

HTH,

Warren Vail

> -----Original Message-----
> From: Daniel Brown [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 10, 2008 8:48 AM
> To: Humani Power
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Dependant listboxes
> 
> On Jan 10, 2008 11:43 AM, Humani Power <[EMAIL PROTECTED]> wrote:
> > Hi everybody.
> > I have a page with 3 combo box that contains rows from an oracle
> database.
> > What I want to do, is to make those list dependant one from another.
> >
> > Let say that I have the combo boxes on a page1.php, then on change the
> first
> > list box, reload the page1.php and make the selection of the second
> listbox,
> > on change on the second
> > box, the third listbox will be filled. Then, pressing the submit
> > button, I want to go to the
> > page2.php
> >
> > I dont want to use javascript. Does anyone knows where can I find an
> example
> > to implement the dependant lists?
> 
>     There's no way to do that without JavaScript (or some other
> client-side scripting - such as WSH, VBSH, AS, or whatever else may be
> available).  In fact, onChange is a client-side command.
> 
> --
> </Dan>
> 
> Daniel P. Brown
> Senior Unix Geek and #1 Rated "Year's Coolest Guy" By Self Since 1979.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to