[PHP] Menu populated based on previous menu

2003-10-28 Thread Robb Kerr
Searched all the sites I could find for this problem to no avail. I have
two dropdown menus in a form. The first menu contains a list of
MANUFACTURERS obtained from a database. The second contains a list of
MODELS also obtained from the database. I want the second menu to be
populated based upon the selection in the first. In other words, once a
visitor has selected a MANUFACTURER they'll be presented with a list of
MODELS that are available from the selected MANUFACTURER.

I know how to do the queries, but don't know how to initiate the query and
rebuild the second menu when the first selection is made without adding a
SUBMIT button and loading a second page.

Anyone know how to accomplish this? Thanx in advance.
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



Re: [PHP] Menu populated based on previous menu

2003-10-28 Thread Nitin
I've solved same kind of problems with the help of HTML frames, if you are
interested, drop me a mail, or if you find better option, please let me
know.

Nitin


- Original Message - 
From: Robb Kerr [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 28, 2003 9:15 PM
Subject: [PHP] Menu populated based on previous menu


 Searched all the sites I could find for this problem to no avail. I have
 two dropdown menus in a form. The first menu contains a list of
 MANUFACTURERS obtained from a database. The second contains a list of
 MODELS also obtained from the database. I want the second menu to be
 populated based upon the selection in the first. In other words, once a
 visitor has selected a MANUFACTURER they'll be presented with a list of
 MODELS that are available from the selected MANUFACTURER.

 I know how to do the queries, but don't know how to initiate the query and
 rebuild the second menu when the first selection is made without adding a
 SUBMIT button and loading a second page.

 Anyone know how to accomplish this? Thanx in advance.
 -- 
 Robb Kerr
 Digital IGUANA
 Helping Digital Artists Achieve their Dreams
 http://www.digitaliguana.com
 http://www.cancerreallysucks.org

 -- 
 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



Re: [PHP] Menu populated based on previous menu

2003-10-28 Thread CPT John W. Holmes
From: Robb Kerr [EMAIL PROTECTED]


 Searched all the sites I could find for this problem to no avail. I have
 two dropdown menus in a form. The first menu contains a list of
 MANUFACTURERS obtained from a database. The second contains a list of
 MODELS also obtained from the database. I want the second menu to be
 populated based upon the selection in the first. In other words, once a
 visitor has selected a MANUFACTURER they'll be presented with a list of
 MODELS that are available from the selected MANUFACTURER.

 I know how to do the queries, but don't know how to initiate the query and
 rebuild the second menu when the first selection is made without adding a
 SUBMIT button and loading a second page.

 Anyone know how to accomplish this? Thanx in advance.

This is a pretty common question. You need to employ some Javascript to get
this to work the way you want it to, though.

To do this purely in PHP, then the SUBMIT button required, as PHP cannot
change the client side form elements, only the source code sent to the
browser.

That said, you can use your queries in PHP to build the Javascript variables
/ arrays. As you loop through the query results, you create the arrays with
all of the possible MODEL values. Then when your user selects a
MANUFACTURER, the javascript reads the arrays that PHP wrote into the source
code and loads the appropriate one into the MODEL select box.

Keep searching, examples are out there.

---John Holmes...

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



Re: [PHP] Menu populated based on previous menu

2003-10-28 Thread Larry E . Ullman
Searched all the sites I could find for this problem to no avail. I 
have
two dropdown menus in a form. The first menu contains a list of
MANUFACTURERS obtained from a database. The second contains a list of
MODELS also obtained from the database. I want the second menu to be
populated based upon the selection in the first. In other words, once a
visitor has selected a MANUFACTURER they'll be presented with a list of
MODELS that are available from the selected MANUFACTURER.

I know how to do the queries, but don't know how to initiate the query 
and
rebuild the second menu when the first selection is made without 
adding a
SUBMIT button and loading a second page.
You can't do this with PHP (server-side), you'll need to use JavaScript 
(client-side). Check out some JavaScript sites for examples, then use 
PHP to populate the JavaScript arrays.

Larry

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


Re: [PHP] Menu populated based on previous menu

2003-10-28 Thread Robb Kerr
Thanx for the tips. I'll search the JavaScript sites and see what I can
come up with.
-- 
Robb Kerr
Digital IGUANA

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



Re: [PHP] Menu populated based on previous menu

2003-10-28 Thread Radu Manole
here is a link that might help

http://www.macromedia.com/support/ultradev/ts/documents/client_dynamic_listb
ox.htm

Radu

- Original Message -
From: Robb Kerr [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 28, 2003 5:59 PM
Subject: Re: [PHP] Menu populated based on previous menu


 Thanx for the tips. I'll search the JavaScript sites and see what I can
 come up with.
 --
 Robb Kerr
 Digital IGUANA

 --
 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



Re: [PHP] Menu populated based on previous menu

2003-10-28 Thread Verdon Vaillancourt
There's a nice GPL class that does this quite well. It could save you a lot
of work and will definitely provide an example.

Check out;
http://www.phpclasses.org/search.html?words=linked_selectgo_search=1



On 10/28/03 12:26 PM, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

 - Original Message -
 From: Robb Kerr [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, October 28, 2003 5:59 PM
 Subject: Re: [PHP] Menu populated based on previous menu
 
 
 Thanx for the tips. I'll search the JavaScript sites and see what I can
 come up with.
 --
 Robb Kerr
 Digital IGUANA
 
 --
 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



Re: [PHP] Menu populated based on previous menu

2003-10-28 Thread Robb Kerr
I've found some JavaScripts that will do what I require. Here's the
question before I get to deeply into hacking the scripts...

Can you embed PhP in JavaScript. In other words, the Java requires that
arrays be filled. The entries into these arrays need to come from my
database which is accessed via PhP. 

In Java line...
new Array()

can I embed the PhP...
?php echo $database['field']; ?

Thanx,
-- 
Robb Kerr
Digital IGUANA

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



RE: [PHP] Menu populated based on previous menu

2003-10-28 Thread Pablo Gosse
Hi Robb.  This is exactly what you'll need to do.

Something like the following, assuming you're populating an array with
user information:

script type=text/javascript
!--
var users = new Array();
?php
$count = 0;
while (!$users-EOF))
{
echo 'users['.$count.'] = '.$users-fields['username'].chr(10);
$count++;
$users-MoveNext();
}
?
//--
/script

The users array will now be populated with the usernames returned from
your query.

Cheers,
Pablo

-Original Message-
From: Robb Kerr [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 28, 2003 9:48 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Menu populated based on previous menu

I've found some JavaScripts that will do what I require. Here's the
question before I get to deeply into hacking the scripts...

Can you embed PhP in JavaScript. In other words, the Java requires that
arrays be filled. The entries into these arrays need to come from my
database which is accessed via PhP. 

In Java line...
new Array()

can I embed the PhP...
?php echo $database['field']; ?

Thanx,
-- 
Robb Kerr
Digital IGUANA

-- 
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



Re: [PHP] Menu populated based on previous menu

2003-10-28 Thread Robb Kerr
On Tue, 28 Oct 2003 09:52:02 -0800, Pablo Gosse wrote:

 Hi Robb.  This is exactly what you'll need to do.
 
 Something like the following, assuming you're populating an array with
 user information:
 
 script type=text/javascript
 !--
 var users = new Array();
 ?php
 $count = 0;
 while (!$users-EOF))
 {
   echo 'users['.$count.'] = '.$users-fields['username'].chr(10);
   $count++;
   $users-MoveNext();
 }
 ?
 //--
 /script
 
 The users array will now be populated with the usernames returned from
 your query.
 
 Cheers,
 Pablo
 

Thanx Pablo. I'll give that a try.
-- 
Robb Kerr
Digital IGUANA

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



RE: [PHP] Menu populated based on previous menu

2003-10-28 Thread Luis Lebron
You may want to look at the following article:

http://www.zend.com/zend/tut/drop-down.php


Luis

-Original Message-
From: Robb Kerr [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 28, 2003 9:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Menu populated based on previous menu


Searched all the sites I could find for this problem to no avail. I have
two dropdown menus in a form. The first menu contains a list of
MANUFACTURERS obtained from a database. The second contains a list of
MODELS also obtained from the database. I want the second menu to be
populated based upon the selection in the first. In other words, once a
visitor has selected a MANUFACTURER they'll be presented with a list of
MODELS that are available from the selected MANUFACTURER.

I know how to do the queries, but don't know how to initiate the query and
rebuild the second menu when the first selection is made without adding a
SUBMIT button and loading a second page.

Anyone know how to accomplish this? Thanx in advance.
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

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