RE: [PHP] Linked drop down selection lists and dynamically generated links
The only problem is that this page isn't completely dynamic. For example, column #3 should automatically update when column #2 changes. Plus, imagine what happens when the page and the form both become more complex. I guess I'm just spouting off my opinion that Javascript is the easier solution - even though I'd prefer PHP to handle everything for me. -Original Message- Here's a simple quick code (partial) how I'd do it on one php page: http://photography-on-the.net/php/3_choice_select.php This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you very much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linked drop down selection lists and dynamically generated links
At 7/7/2002, you wrote: >Is there any way of doing this so within a single page? > >Can this be done using only PHP or do I need to use Javascripts? >Where would I be able to find examples of code which does this sort of >processing? Hi, I would do it in PHP, because you can never ever rely on Javascript (is it on? what version? what browser?). Javascript is good for additional UI smoothing, but should never be a requirement (nor should cookies be). Here's a simple quick code (partial) how I'd do it on one php page: http://photography-on-the.net/php/3_choice_select.php Use the resulting ID's to query the full data of the "product" found. There is source code and db dump link in the bottom of that page. The database is very normalized. I did and debugged this in couple of hours (I know, I'm slow), and this needs _plenty_ of more code like clearing choices from "product" and "version" when "platform" is changed, and checking valid "platform" id etc... this is just a core which gives you id's for additional queries. If you improve this please share the code! Hope this helps, Pekka http://photography-on-the.net
RE: [PHP] Linked drop down selection lists and dynamically generated links
You can use both JavaScript and PHP. Initially use PHP to get your data, you can use 13 arrays to store this data. 1st array stores the options for the 1st list. The other 12 arrays can store options related to each item of the 1st list/array. Use JavaScript (client-side scripting, faster) to populate the 2nd list based on the selection in the 1st list. This way you do not run PHP (server-side scripting, slower) more than once on the same page. this is of course, keeping in mind, that your backend (database data) is not changing every few seconds. If you are dealing with dynamic data, such that the list options might be changing at every moment then you would need the latest database data and PHP would need to be used after the selection in the 1st list. -Naintara -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] t]On Behalf Of Peter Goggin Sent: Saturday, July 06, 2002 10:31 PM To: [EMAIL PROTECTED] Subject: [PHP] Linked drop down selection lists and dynamically generated links I have two related tables. The first has about 12 records, each of which is related to about 12 records in the second table. I want to have two interconnectedt dropdown list fields. The fisrt is used to select from the first table and when the value has been selected, use it to determine the contents of the second drop down list. Once the second field has been selected I want to use this data to otain the name of the form to be used to display data selected using the two fields. Obviously I can do this by having interrelated pages where the value from the first fields is carried to the second page and used to populate the second drop down list. I can then presumably dynamically generate the link to the required page and pass over what paraeters are needed. Is there any way of doing this so within a single page? Can this be done using only PHP or do I need to use Javascripts? Where would I be able to find examples of code which does this sort of processing? Any adivice would be gratefully received. Regards Peter Goggin Regards Peter Goggin -- 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] Linked drop down selection lists and dynamically generated links
As Alberto says, PHP has to be used to do such thing ONLY when Java is not acceptable. There are many JavaScript snippets out there that do such things. Most of them are called *DOUBLE COMBO* but as I recently found out in this list, and from a similar question I had, is NOT so simple for PHP to figure out what was chosen in the second choice. Try to read post made the last month and you'll get the answer to all this. C. > -Original Message- > From: Alberto Serra [mailto:[EMAIL PROTECTED]] > Sent: Sunday, July 07, 2002 2:44 AM > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Linked drop down selection lists and dynamically > generated links > > §±§â§Ú§Ó§Ö§ä! > > Peter Goggin wrote: > > Can this be done using only PHP or do I need to use Javascripts? > > managing this in PHP should be considered *only* when jscript is not > available. It's a matter of load distribution. > > When doing client server applications (like the web is) you shall always > remember that any interaction about the two entities adds up time to the > result. Which, incidentally, is the point in using Stored Procedures > (when they are properly coded and the db engine is capable of supporting > them) instead of making tons of single SQL calls from a single PHP script. > > Now, if all of your data is already on the client (somehow stoked in > jscript variables) your user interaction will be quick and easy. If you > call PHP any time you will get a serious delay (because you do issue a > request along the net, then the server processes it and sends it back to > your browser, that again processes it and shows it). So this should be > considered an emergency solution only. > > A 100% robust solution should contain both, and call PHP only if jscript > is not available on the client. But this is costly and requires the two > procedures to be realigned everytime you have some change going on. Most > applications can just use javascript and forget about it. > > §á§à§Ü§Ñ > §¡§Ý§î§Ò§Ö§â§ä§à > §¬§Ú§Ö§Ó > > > -- > > > @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ > > LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? > lOrD i'M sHiNiNg... > YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE > tHe TeSt, YeS iT iS > ThE tEsT, yEs It Is > tHe TeSt, YeS iT iS > ThE tEsT, yEs It Is... > > > -- > 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
[PHP] Linked drop down selection lists and dynamically generated links
I have two related tables. The first has about 12 records, each of which is related to about 12 records in the second table. I want to have two interconnectedt dropdown list fields. The fisrt is used to select from the first table and when the value has been selected, use it to determine the contents of the second drop down list. Once the second field has been selected I want to use this data to otain the name of the form to be used to display data selected using the two fields. Obviously I can do this by having interrelated pages where the value from the first fields is carried to the second page and used to populate the second drop down list. I can then presumably dynamically generate the link to the required page and pass over what paraeters are needed. Is there any way of doing this so within a single page? Can this be done using only PHP or do I need to use Javascripts? Where would I be able to find examples of code which does this sort of processing? Any adivice would be gratefully received. Regards Peter Goggin Regards Peter Goggin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php