Dependant listboxes

This is a discussion on Dependant listboxes within the PHP General forums, part of the PHP Programming Forums category; Hi everybody. I have a page with 3 combo box that contains rows from an oracle database. What I want ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-10-2008
Humani Power
 
Posts: n/a
Default Dependant listboxes

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?


Thanks in advance.

Reply With Quote
  #2 (permalink)  
Old 01-10-2008
Daniel Brown
 
Posts: n/a
Default Re: [PHP] Dependant listboxes

On Jan 10, 2008 11:43 AM, Humani Power <jiuman@gmail.com> 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.
Reply With Quote
  #3 (permalink)  
Old 01-10-2008
Zoltán Németh
 
Posts: n/a
Default Re: [PHP] Dependant listboxes

2008. 01. 10, csütörtök keltezéssel 10.43-kor Humani Power ezt Ã*rta:
> 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?


with javascript.

greets
Zoltán Németh

>
>
> Thanks in advance.

Reply With Quote
  #4 (permalink)  
Old 01-10-2008
Warren Vail
 
Posts: n/a
Default RE: [PHP] Dependant listboxes

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:parasane@gmail.com]
> 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 <jiuman@gmail.com> 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

Reply With Quote
  #5 (permalink)  
Old 01-11-2008
Manuel Lemos
 
Posts: n/a
Default Re: Dependant listboxes

Hello,

on 01/10/2008 02:43 PM Humani Power said the following:
> 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?


This popular PHP forms generation and validation class has a linked
select plug-in to do precisely that.

http://www.phpclasses.org/formsgeneration


The basic version use alternative groups of option values taken from
arrays, but there are also variant versions of the plug-in that take
options from database query results.

Here is a live example of the version that uses arrays:

http://www.meta-language.net/forms-e..._linked_select


There is one variant that supports MySQL and two other variants that
support many databases, including Oracle, using either the Metabase or
PEAR::MDB2 database independent APIs.


Here you may watch a tutorial video that explains about this and other
plug-ins of this forms class:

http://www.phpclasses.org/browse/vid...ed-select.html


--

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Reply With Quote
  #6 (permalink)  
Old 01-14-2008
Richard Lynch
 
Posts: n/a
Default Re: [PHP] Dependant listboxes



On Thu, January 10, 2008 10:43 am, Humani Power 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?


If you are willing to have them push the submit button and get a new
page for each listbox, then you have a straight-forward PHP
application.

If not, then you HAVE to use JavaScript, and PHP is not in the picture
at all.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:13 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0