RE: [PHP] dynamic drop down
Danny Brow mailto:[EMAIL PROTECTED] on Saturday, June 04, 2005 2:45 PM said: So how do you refresh the page when the drop down is selected? With javascript or force the user to click a submit button. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic drop down
in the drop down look up : onChange=your java script - Original Message - From: Chris W. Parker [EMAIL PROTECTED] To: Danny Brow [EMAIL PROTECTED]; PHP-Users php-general@lists.php.net Sent: Monday, June 06, 2005 2:34 PM Subject: RE: [PHP] dynamic drop down Danny Brow mailto:[EMAIL PROTECTED] on Saturday, June 04, 2005 2:45 PM said: So how do you refresh the page when the drop down is selected? With javascript or force the user to click a submit button. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.6.4 - Release Date: 06/06/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dynamic drop down
On Mon, June 6, 2005 2:34 pm, Chris W. Parker said: Danny Brow mailto:[EMAIL PROTECTED] on Saturday, June 04, 2005 2:45 PM said: So how do you refresh the page when the drop down is selected? With javascript or force the user to click a submit button. To be clear, and forestall the But that's not PHP! response... With javascriopt or force the user to click a submit button. ... that goes *back* to the server to load a PHP script. So your onChange=... would have something that resulted in: .location=somefancymenuscript.php in it. This would be incredibly inefficient and a really dumb way to do dynamic drop down menus unless you can guarantee high-bandwidth low-latency in an Intranet setting, and even then is probably not truly the BEST answer. Which, after you boil away 10,000 posts to the PHP list turns out to be: Use JavaScript. Go away. :-) :-) :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dynamic drop down
On Wed, 2005-06-01 at 11:49 +0100, Mark Rees wrote: The dropdown list is on the client (browser). Javascript runs on the client. PHP runs on the server. You have 2 options - one is to do as Richard says and use javascript to change the contents of one select box when an option is selected in another. - the other is to refresh the page when the option is selected and write different data into the second select box based on the option selected. This is a question of using echo and iterating through the data you wish to output. So how do you refresh the page when the drop down is selected? Thanks, Dan. -Original Message- From: Danny Brow [mailto:[EMAIL PROTECTED] Sent: 01 June 2005 07:08 To: PHP-Users Subject: Re: [PHP] dynamic drop down On Tue, 2005-05-31 at 22:08 -0700, Richard Lynch wrote: On Tue, May 31, 2005 8:48 pm, Danny Brow said: Could someone point me to an example with code for dynamic drop downs in PHP? I would like to be able to have drop downs like Select Country and another drop down show the states/provinces based on the selected country. Well, the dynamic part of it isn't gonna be in PHP at all ; It's gonna be JavaScript. I thought I'd have to use JS, but was hoping someone knew a way to do it with PHP. You can Google for JavaScript dynamic menus to find what you want. Then you just need to use PHP to spew out the JavaScript you want to spew out, but that's no different than spewing out the HTML you want to spew out, really. Tons on google, thanks, Dan. Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, Cisco, Sun Microsystems, 3Com GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND REGISTERED FOR ISO 9001:2000 CERTIFICATION ** CONFIDENTIALITY NOTICE: This Email is confidential and may also be privileged. If you are not the intended recipient, please notify the sender IMMEDIATELY; you should not copy the email or use it for any purpose or disclose its contents to any other person. GENERAL STATEMENT: Any statements made, or intentions expressed in this communication may not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content herein may be held binding upon Gamma Global (UK) Ltd or any associated company unless confirmed by the issuance of a formal contractual document or Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com EOE ** ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dynamic drop down
The dropdown list is on the client (browser). Javascript runs on the client. PHP runs on the server. You have 2 options - one is to do as Richard says and use javascript to change the contents of one select box when an option is selected in another. - the other is to refresh the page when the option is selected and write different data into the second select box based on the option selected. This is a question of using echo and iterating through the data you wish to output. -Original Message- From: Danny Brow [mailto:[EMAIL PROTECTED] Sent: 01 June 2005 07:08 To: PHP-Users Subject: Re: [PHP] dynamic drop down On Tue, 2005-05-31 at 22:08 -0700, Richard Lynch wrote: On Tue, May 31, 2005 8:48 pm, Danny Brow said: Could someone point me to an example with code for dynamic drop downs in PHP? I would like to be able to have drop downs like Select Country and another drop down show the states/provinces based on the selected country. Well, the dynamic part of it isn't gonna be in PHP at all ; It's gonna be JavaScript. I thought I'd have to use JS, but was hoping someone knew a way to do it with PHP. You can Google for JavaScript dynamic menus to find what you want. Then you just need to use PHP to spew out the JavaScript you want to spew out, but that's no different than spewing out the HTML you want to spew out, really. Tons on google, thanks, Dan. Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, Cisco, Sun Microsystems, 3Com GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND REGISTERED FOR ISO 9001:2000 CERTIFICATION ** CONFIDENTIALITY NOTICE: This Email is confidential and may also be privileged. If you are not the intended recipient, please notify the sender IMMEDIATELY; you should not copy the email or use it for any purpose or disclose its contents to any other person. GENERAL STATEMENT: Any statements made, or intentions expressed in this communication may not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content herein may be held binding upon Gamma Global (UK) Ltd or any associated company unless confirmed by the issuance of a formal contractual document or Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com EOE ** ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic drop down
On Tue, May 31, 2005 8:48 pm, Danny Brow said: Could someone point me to an example with code for dynamic drop downs in PHP? I would like to be able to have drop downs like Select Country and another drop down show the states/provinces based on the selected country. Well, the dynamic part of it isn't gonna be in PHP at all ; It's gonna be JavaScript. I *do* use PHP in a cron job to routinely check the ISO (IEEE?) standard for country codes and names and re-build my list of countries from their list, so that when/if a country has a civil war or whatever I have a CURRENT list. I suppose one could/should do the same with states and provinces, though those seem less likely to change, actually. You can Google for JavaScript dynamic menus to find what you want. Then you just need to use PHP to spew out the JavaScript you want to spew out, but that's no different than spewing out the HTML you want to spew out, really. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic drop down
On Tue, 2005-05-31 at 22:08 -0700, Richard Lynch wrote: On Tue, May 31, 2005 8:48 pm, Danny Brow said: Could someone point me to an example with code for dynamic drop downs in PHP? I would like to be able to have drop downs like Select Country and another drop down show the states/provinces based on the selected country. Well, the dynamic part of it isn't gonna be in PHP at all ; It's gonna be JavaScript. I thought I'd have to use JS, but was hoping someone knew a way to do it with PHP. You can Google for JavaScript dynamic menus to find what you want. Then you just need to use PHP to spew out the JavaScript you want to spew out, but that's no different than spewing out the HTML you want to spew out, really. Tons on google, thanks, Dan. signature.asc Description: This is a digitally signed message part
[PHP] dynamic drop down
Could someone point me to an example with code for dynamic drop downs in PHP? I would like to be able to have drop downs like Select Country and another drop down show the states/provinces based on the selected country. Thanks, Dan. signature.asc Description: This is a digitally signed message part
[PHP] dynamic drop down
Hey, I am trying to make a drop down list such that, when some one selects an option, it refreshs and displays the option on the same page. There are a couple of things already in the URL [ the query string ], which need to remain there. How would I do this easily? Regards, Kunal Jhunjhunwala Minds think with ideas, not information. No amount of data, bandwidth, or processing power can substitute for inspired thought. - Clifford Stoll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic drop down
Hi Kunul, I think I have code that does what you want: function QuickJumpSelect($name=, $optionvalues, $optionnames, $stylestr=) { ($stylestr != )? $style = $stylestr : $style = ; // Calculate stuff $count = count($optionnames); $output = ; // -- Start outputting the SELECT -- $output .= SELECT NAME=\$name\$style $size OnChange=JumpToRef(this); $output .= option value=\\Jump to:/option\n; for($idx = 0; $idx $count; ++$idx){ $name = $optionnames[$idx]; $val = trim($optionvalues[$idx]); $output .= option value=\$val\$name/option\n; } $output .= /SELECT\n; return $output; } // - end function --- Call it like this: $JumpPad = QuickJumpSelect(EenieMeenieMinyMoe, $array_of_urls, $array_of_names_to_show_in_list, $stylestring); stylestring is a CSS argument, like: $stylestring = style=\width: 100px; font-family: Arial; font-size: 10px\; Now you can just print $JumpPad where you want it to be. --- All the best, Eivind :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic drop down
Are you talking about refreshing/dynamicly modifying the pull-down (client side, javascript), or refreshing the page (server side, php)?? You can set a pull down to submit the form onchange, (check out javascript sites for this FAQ) and the action of your form would be something like (untested): FORM action=?= $PHP_SELF.?.$QUERY_STRING ? method=post This will call the current page, with the current query string, which I thin is your question. Justin French - http://indent.com.au http://soundpimps.com - on 23/04/02 9:01 PM, Kunal Jhunjhunwala ([EMAIL PROTECTED]) wrote: Hey, I am trying to make a drop down list such that, when some one selects an option, it refreshs and displays the option on the same page. There are a couple of things already in the URL [ the query string ], which need to remain there. How would I do this easily? Regards, Kunal Jhunjhunwala Minds think with ideas, not information. No amount of data, bandwidth, or processing power can substitute for inspired thought. - Clifford Stoll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic drop down
On Tuesday, April 23, 2002, at 07:01 AM, Kunal Jhunjhunwala wrote: I am trying to make a drop down list such that, when some one selects an option, it refreshs and displays the option on the same page. There are a couple of things already in the URL [ the query string ], which need to remain there. How would I do this easily? First, you need to use JavaScript (I think the onchange handler) to automatically submit the form when the user selects an option from the dropdown list. That's no big deal. But to maintain the querystring, you will need to do a bit of finagling -- but it's nothing hard. You could either use $_SERVER['QUERYSTRING'] and place the value of this variable into a hidden form field, or you could do a foreach ($_GET) and concatenate the results into a string and place that into a hidden form field. If you aren't sure what I'm talking about I can write up an example. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dynamic drop down
Do you want to submit every time the dropdown changes? If you just want the second dropdown to update and don't want a submit, let me know. I am doing this in one of my programs and I can send you some code if you think it would help. Ex of my program: We want to show populations. There's a state box and when you select a state then the county box fills up with counties for that state (along with an Entire State option). We have them set up using boxes that are 3 tall, I think (maybe 5). For some reason it didn't work as well when we did regular dropdowns, so this was our current workaround. We use onload in the body tag, onchange in the state box tag, and use a JS method to populate the second dropdown. Good luck! -Natalie -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 10:02 AM To: Kunal Jhunjhunwala Cc: php-list Subject: Re: [PHP] dynamic drop down On Tuesday, April 23, 2002, at 07:01 AM, Kunal Jhunjhunwala wrote: I am trying to make a drop down list such that, when some one selects an option, it refreshs and displays the option on the same page. There are a couple of things already in the URL [ the query string ], which need to remain there. How would I do this easily? First, you need to use JavaScript (I think the onchange handler) to automatically submit the form when the user selects an option from the dropdown list. That's no big deal. But to maintain the querystring, you will need to do a bit of finagling -- but it's nothing hard. You could either use $_SERVER['QUERYSTRING'] and place the value of this variable into a hidden form field, or you could do a foreach ($_GET) and concatenate the results into a string and place that into a hidden form field. If you aren't sure what I'm talking about I can write up an example. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- 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] Dynamic Drop-down list
I create a Drop-down from a DB table. All works as expected *except* the default item (the one showing to the surfer) is the last in the list. Is there a way I can have the first item show? Todd /* Make a drop-down */ function make_dropdown($ddName, $itemList, $first) { if (count($itemList)) { echo("SELECT NAME=" . $ddName . ""); if ($first) { echo('OPTION VALUE="**" SELECTED' . $first); }; while (list ($key, $val) = each ($itemList)) { echo('OPTION VALUE="' . $key . '" SELECTED' . $val); }; echo("/SELECT"); }; }; -- Todd Cary Ariste Software [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] Dynamic Drop-down list
the 'SELECTED' attribute will select an item in a dropdown list. by default, with no SELECTED attribute, the first item will be shown and selected. make sense? DanO -Original Message- From: Todd Cary [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 08, 2001 5:00 PM To: [EMAIL PROTECTED] Subject: [PHP] Dynamic Drop-down list I create a Drop-down from a DB table. All works as expected *except* the default item (the one showing to the surfer) is the last in the list. Is there a way I can have the first item show? Todd /* Make a drop-down */ function make_dropdown($ddName, $itemList, $first) { if (count($itemList)) { echo("SELECT NAME=" . $ddName . ""); if ($first) { echo('OPTION VALUE="**" SELECTED' . $first); }; while (list ($key, $val) = each ($itemList)) { echo('OPTION VALUE="' . $key . '" SELECTED' . $val); }; echo("/SELECT"); }; }; -- Todd Cary Ariste Software [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] -- 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]