Re: [PHP] Updating dropdown list

2007-06-16 Thread tedd

At 12:38 PM -0600 6/11/07, Ashley M. Kirchner wrote:
   I have a page containing two drop down lists.  I need to figure 
out a way to populate/update the second drop down list based on a 
selection of the first one (the data for both drop down lists is in 
a MySQL database).  Is this something I need to do in JavaScript? 
Or can I somehow trick PHP to do this?



Ashley:

In this case, I think js would be a better choice. You can get the code here:

http://www.webbytedd.com/b/dyn-select/

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Updating dropdown list

2007-06-16 Thread tedd

At 8:57 PM +0200 6/11/07, Tijnema wrote:

On 6/11/07, Ashley M. Kirchner <[EMAIL PROTECTED]> wrote:

Tijnema wrote:

 But Javascript != PHP, so if this is what you want, you're on the
 wrong list...

   Ik weet dat meneer.  But I also hate JavaScript.  So if I can avoid
it and use PHP, then I will.  Hence me asking here first to see if I can
get it accomplished with PHP.  :)


Just keep in mind that PHP is server side, and can't do anything on
the client, except that you can make PHP request calls with ajax, but
then there's still not really PHP involved.

Tijnema


Tijnema:

In most of my ajax solutions, I still use php. Here's an example:

http://xn--nvg.com/ajax

All the html is provided/generated by php.

However, the example is very much out of date with respect to 
unobtrusive javascript. DOM scripting is mondo kewl.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Updating dropdown list

2007-06-16 Thread tedd

At 12:55 PM -0600 6/11/07, Ashley M. Kirchner wrote:
But I also hate JavaScript.  So if I can avoid it and use PHP, then 
I will.  Hence me asking here first to see if I can get it 
accomplished with PHP.  :)


Don't hate it -- Javascript is just another cool language. You can do 
some amazing things with it. Like this:


http://www.webbytedd.com/a/move/

Couple php, js, css, mysql, and html together, you have yourself a 
nice package for doing stuff. They all look like parts of a single 
web language same to me.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Updating dropdown list

2007-06-11 Thread Ashley M. Kirchner

Tijnema wrote:

I think he means something like on the nvidia driver download page [1]
This is only possible with javascript, you could take a look at the
page I gave to see how they did it ;)
But Javascript != PHP, so if this is what you want, you're on the 
wrong list...


Tijnema

[1] http://www.nvidia.com/content/drivers/drivers.asp

   Honestly, that's overkill.  Though elegant, I don't need something 
like that.  Just a drop down that allows one to pick names, and when 
picked it would update a second drop down (on the same page) with events 
related to that name.  Then one can pick one of those events and hit a 
submit button to trigger an external script.


--
W | It's not a bug - it's an undocumented feature.
 +
 Ashley M. Kirchner    .   303.442.6410 x130
 IT Director / SysAdmin / Websmith . 800.441.3873 x130
 Photo Craft Imaging   . 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A. 


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



Re: [PHP] Updating dropdown list

2007-06-11 Thread Philip Thompson

On Jun 11, 2007, at 1:52 PM, Jay Blanchard wrote:


[snip]
Without refreshing the page would require JavaScript, but if it
doesn't matter if the page is refreshed, you could use PHP.
[/snip]

Or a combination, using AJAX.



Or you could use CSS and JS. Use PHP to populate all your lists (may  
be time-consuming if you have lots of really large lists) from your  
MySQL database. Only show the first drop-down upon load. Then, based  
off of what's selected in that list, show/hide your other lists as well.


This won't be as "pretty" b/c in the HTML source you'll have lots of  
nasty lists, but it's an option. Good luck!


~Philip

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



Re: [PHP] Updating dropdown list

2007-06-11 Thread Paul Novitski

At 6/11/2007 11:38 AM, Ashley M. Kirchner wrote:
   I have a page containing two drop down lists.  I need to figure 
out a way to populate/update the second drop down list based on a 
selection of the first one (the data for both drop down lists is in 
a MySQL database).  Is this something I need to do in 
JavaScript?  Or can I somehow trick PHP to do this?



I don't think you need to trick PHP -- it will be friendly and 
cooperative as long as you feed it some nice juicy strings from time to time.


The main difference between implementing this in javascript and 
implementing it in PHP is that PHP will require a round-trip to the 
server between menu changes, while javascript will act more immediately.


Because javascript is so commonly disabled, I write the logic first 
in PHP so that everyone can use the page, then again in javascript to 
enhance the experience for folks with scripting enabled.  This is not 
a doubling of work: both scripts can utilize the same datasets (since 
PHP is downloading the page it can feed javascript a version of the 
same data it uses), and both scripts have very similar syntax 
(they're really cousins) so it's possible in many cases to write 
nearly identical logic in key functions, reducing programming, 
debugging, and maintenance time.  This technique is known variously 
as 'unobtrusive javascript' and 'progressive enhancement.'


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


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



Re: [PHP] Updating dropdown list

2007-06-11 Thread Tijnema

On 6/11/07, Ashley M. Kirchner <[EMAIL PROTECTED]> wrote:

Tijnema wrote:
> But Javascript != PHP, so if this is what you want, you're on the
> wrong list...
   Ik weet dat meneer.  But I also hate JavaScript.  So if I can avoid
it and use PHP, then I will.  Hence me asking here first to see if I can
get it accomplished with PHP.  :)


Just keep in mind that PHP is server side, and can't do anything on
the client, except that you can make PHP request calls with ajax, but
then there's still not really PHP involved.

Tijnema





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



Re: [PHP] Updating dropdown list

2007-06-11 Thread Ashley M. Kirchner

Tijnema wrote:
But Javascript != PHP, so if this is what you want, you're on the 
wrong list...
   Ik weet dat meneer.  But I also hate JavaScript.  So if I can avoid 
it and use PHP, then I will.  Hence me asking here first to see if I can 
get it accomplished with PHP.  :)


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



Re: [PHP] Updating dropdown list

2007-06-11 Thread Tijnema

On 6/11/07, Daniel Brown <[EMAIL PROTECTED]> wrote:

On 6/11/07, Ashley M. Kirchner <[EMAIL PROTECTED]> wrote:
>
> I have a page containing two drop down lists.  I need to figure out
> a way to populate/update the second drop down list based on a selection
> of the first one (the data for both drop down lists is in a MySQL
> database).  Is this something I need to do in JavaScript?  Or can I
> somehow trick PHP to do this?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

   Without refreshing the page would require JavaScript, but if it
doesn't matter if the page is refreshed, you could use PHP.
--
Daniel P. Brown


I think he means something like on the nvidia driver download page [1]
This is only possible with javascript, you could take a look at the
page I gave to see how they did it ;)
But Javascript != PHP, so if this is what you want, you're on the wrong list...

Tijnema

[1] http://www.nvidia.com/content/drivers/drivers.asp

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



RE: [PHP] Updating dropdown list

2007-06-11 Thread Jay Blanchard
[snip]
Without refreshing the page would require JavaScript, but if it
doesn't matter if the page is refreshed, you could use PHP.
[/snip]

Or a combination, using AJAX. 

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



Re: [PHP] Updating dropdown list

2007-06-11 Thread Jim Lucas

Ashley M. Kirchner wrote:


   I have a page containing two drop down lists.  I need to figure out a 
way to populate/update the second drop down list based on a selection of 
the first one (the data for both drop down lists is in a MySQL 
database).  Is this something I need to do in JavaScript?  Or can I 
somehow trick PHP to do this?



client side = Javascript

maybe mix it with PHP with an AJAX call or something...

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Updating dropdown list

2007-06-11 Thread Daniel Brown

On 6/11/07, Ashley M. Kirchner <[EMAIL PROTECTED]> wrote:


I have a page containing two drop down lists.  I need to figure out
a way to populate/update the second drop down list based on a selection
of the first one (the data for both drop down lists is in a MySQL
database).  Is this something I need to do in JavaScript?  Or can I
somehow trick PHP to do this?

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




   Without refreshing the page would require JavaScript, but if it
doesn't matter if the page is refreshed, you could use PHP.


--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



[PHP] Updating dropdown list

2007-06-11 Thread Ashley M. Kirchner


   I have a page containing two drop down lists.  I need to figure out 
a way to populate/update the second drop down list based on a selection 
of the first one (the data for both drop down lists is in a MySQL 
database).  Is this something I need to do in JavaScript?  Or can I 
somehow trick PHP to do this?


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