Re: [PHP] Dynamically created dropdowns
Michael, Many thanks for your help. I've opted for the 'straight PHP' route and, in the process, saved myself a lot of time pointlessly trying to see if JavaScript could read from the database. Michael Egan Michael Hall wrote: > > You can certainly do what you want in straight PHP if you include a form > submission after selecting the manufacturer. There is probably a way of > doing it in JavaScript without a form submission, but not one that will > read data from a MySQL database on a remote machine. JavaScript can't do > that. > > Michael > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Dynamically created dropdowns
That's true, but you could use PHP and the MySQL data to generate the JavaScript arrays for the dynamic menus... you can escape into PHP within the
Re: [PHP] Dynamically created dropdowns
But, you can use PHP to dynamically create your .js file that your HTML file calls. Load each of your options and sub options into js arrays and write a js function that swaps out the pull down options on the onChange event of the previous pull down. Depending on the number of options you have, this may be an okay solution. At least with this method, your javascript will have up to date data. >You can certainly do what you want in straight PHP if you include a form >submission after selecting the manufacturer. There is probably a way of >doing it in JavaScript without a form submission, but not one that will >read data from a MySQL database on a remote machine. JavaScript can't do >that. > >Michael > >On Tue, 4 Dec 2001, Michael Egan wrote: > >> Hope this isn't an inappropriate message to send to this list. I suspect >> the response will largely concern JavaScript. >> >> Is there a way of altering the contents of one drop down menu according >> to the item selected in another? >> >> I'm creating a page allowing users to identify the make and model of >> computers received by our charity for refurbishment. Ideally I'd like to >> allow them to select a manufacturer from a drop down menu and for a >> separate drop down menu to then be populated by the models produced by >> that manufacturer. >> >> I have two separate tables in a MySQL database, one for manufacturers >> and one for models with the latter containing a field for the >> manufacturer ID. >> >> Is this possible? >> >> Michael Egan >> >> > >-- > >Michael Hall >[EMAIL PROTECTED] >[EMAIL PROTECTED] >http://openlearningcommunity.org > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Jim Musil - Multimedia Programmer Nettmedia - 212-629-0004 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Dynamically created dropdowns
You can certainly do what you want in straight PHP if you include a form submission after selecting the manufacturer. There is probably a way of doing it in JavaScript without a form submission, but not one that will read data from a MySQL database on a remote machine. JavaScript can't do that. Michael On Tue, 4 Dec 2001, Michael Egan wrote: > Hope this isn't an inappropriate message to send to this list. I suspect > the response will largely concern JavaScript. > > Is there a way of altering the contents of one drop down menu according > to the item selected in another? > > I'm creating a page allowing users to identify the make and model of > computers received by our charity for refurbishment. Ideally I'd like to > allow them to select a manufacturer from a drop down menu and for a > separate drop down menu to then be populated by the models produced by > that manufacturer. > > I have two separate tables in a MySQL database, one for manufacturers > and one for models with the latter containing a field for the > manufacturer ID. > > Is this possible? > > Michael Egan > > -- Michael Hall [EMAIL PROTECTED] [EMAIL PROTECTED] http://openlearningcommunity.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]