Re: related products, how to's best practices
| From: | Ajai Khattri | Date: | Thu, 04 Dec 2003 17:29:56 +0000 |
| Subject: | Re: related products, how to's best practices | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-171864@lists.php.net to get a copy of this message | ||
On Thu, Dec 04, 2003 at 03:43:53PM +0000, Jon Bennett wrote:
> Would I be right in thinking that php alone can't change the content of
> a dropdown once the browser has loaded the file without a page refresh
> ??? In which case I need to source out some javascript, anyone got
> anything that might help me (code, tute, urls etc) as I'm not having
> much luck with google ??
I have done this in JavaScript - but I dont have any code handy.
Basically you will need to pre-generate a series of JavaScript arrays for each
category of product at the top of the web page. Then you have a JavaScript
event handler in the category pulldown that changes the product pulldown to a
different array whenever the category changes (use something like onClick or
onChange or a similar relevant event).
Works pretty well - I once worked on a project which pulled data from Access
via ODBC (I was coding in ASP - bleh! Never again... ;-) and generated the web
page with the arrays and JavaScript functions at the top to handle the
switching of the pulldowns.
--
Aj.
Sys. Admin / Developer