Re: [PHP] Dynamic dropdown lists (select)



After reading the rest of the conversation, I think the best solution is the
next thing:
First, if I got this correct, you can extract the makes select-element from
the mysql using a query? if so, then extract it and host is in a temp
variable.
The next thing is writing down a js code, that contains an array of models
for each make. Personally, I'd use a 2 dimension array, the first dimension
for the make id/name and the second for the model id/name.
The 2 dimm. array you write with something like


echo '<script type="text/javascript">var whatever = new Array();';
foreach ($cars as $idx => $car)
echo 'whatever['.$idx.'] = "'.$car->getName().'";';
echo '</script>';


as Zoltan said.
Then you have just simplefied it to a JS based script, i think this is the
best way you will figure out which does NOT contains AJAX, only static JS ;)

HTH,
Nitsan

On 04/04/2008, Nathan Nobbe <quickshiftin@xxxxxxxxx> wrote:

On Fri, Apr 4, 2008 at 1:11 PM, Daniel Brown <parasane@xxxxxxxxx> wrote:

On Fri, Apr 4, 2008 at 9:33 AM, Ryan Yagatich <ryagatich@xxxxxxxxxx>
wrote:
Angelo Zanetti wrote:
> Hi all,
>
> I am looking at options for creating a dynamic dropdown list.
<snip>


> Is there any other idea or thing I can do? Im thinking maybe AJAX
but
this
> is for a mobile site (WAP/xHTML) site and Im not sure if the
functionality
> will work on these devices.
>
>
You're pretty limited to the use of JavaScript here, and even more
limited to what you can do with it. For instance, JS works on the
Treo
700p just fine - but when you get to making HTTP requests through JS
(AJAX and related talk goes here) - they refuse to execute. (The 700p
uses Blazer 4.5 web browser):
http://en.wikipedia.org/wiki/Blazer_(web_browser)<
http://en.wikipedia.org/wiki/Blazer_%28web_browser%29>

For posterity's sake (and an FYI), I'll point out that Internet
Exploder on the Treo 700wx does have a JavaScript parsing engine, but
does *not* handle AJAX very well at all.

I know this comes as a big surprise that a Microsoft product is
lacking when compared to another.


im not a fan of this technique on full-blown web browsers, but in this
case
it sounds like a workaround is called for. you could just handle the
onchange event on the the select element and submit the form to the server
for a full page refresh.
eg.

<form id="ddlForm" method="post" action="">
<select onchange="document.getElementById('ddlForm').submit()">
<!-- options -->
</select>
</form>

you may also consider embedding the form in an iframe to enhance
performance, tho im no expert on the mobile front :D

-nathan



Relevant Pages

  • Re: how to return mulitple corresponding values
    ... This will extract the dates in ascending order, oldest to newest, that meet ... I'm leaving out the sheet name so be sure to add it to your formula. ... Array entered**: ... If you're not using dynamic named ranges then I would "dummy down" ...
    (microsoft.public.excel.worksheet.functions)
  • Copying an array slice (Was: Re: Difficulties with passing multi-dimensional arrays)
    ... to extract an arbitrary-size slice from an arbitrary-size 2D array and I ... perhaps compiler optimisations would remove that seeming benefit - I know ...
    (comp.lang.c)
  • Newbie: Array of pointers to strings questions.
    ... What I'm trying to do is extract information from one file and insert ... and the information in each case is extracted as a string. ... the relevant file is read into a temp file, ... but handling the array was a problem. ...
    (comp.lang.c)
  • Re: Help with String/Array manipulation
    ... I have an array with column widths. ... Next I have a string. ... would like to extract the number of characters based on the column- ...
    (perl.beginners)
  • Re: AJAX problem with php
    ... The headers force it to be a file on the user's system. ... This works fine for simple systems where the page is submitted and then the action is performed by php. ... Using AJAX I have a very complicated page being displayed that takes a while to build. ... I suppose that for this one item I could do what you say and go directly to a php file which pulls in the class to create the array, and then uses the class to export the array to excel and then returns. ...
    (comp.lang.javascript)