Re: Dynamic dropdown lists (select)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 4, 2008 at 2:19 PM, Nitsan Bin-Nun <nitsanbn@xxxxxxxxx> wrote:

> 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 ;)
>

you have to be careful with this approach.  sending too much data to the
client can kill performance; im guessing this is even more sensitive in the
context of mobile client.  just use careful judgement (and testing ! ;)) ;
if there are a couple dozen entries total, probly this route is acceptable.
if there are several hundred....

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux