RE: Creating drop-down menus

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

 



AJAX.

Your page calls a PHP 'ajax' routine that pulls the data, sends it back as a
JS array, and you re-populate the second select box. Welcome to the year
2000. Using frameworks like jQuery, this is pretty trivial these days.
You're not trading any security since the PHP gets whatever parameters and
checks whatever $_SESSION or other authentication and only sends back
whatever data is needed. You can add some caching (memcached or whatever
else) to make subsequent calls lightning fast.

> -----Original Message-----
> From: Ramiro Barrantes [mailto:ramiro@xxxxxxxxxxxxxxxxxxxxx]
> Sent: Monday, July 16, 2012 1:17 PM
> To: php-general@xxxxxxxxxxxxx
> Subject:  Creating drop-down menus
> 
> Hello,
> 
> I am making an application using PHP/Javascript/mysql and had a question.
> 
> Sometimes I need to use javascript to fill a drop down box based on the
> value of a previous drop down box.  However, the information to fill the
> latter is stored in mysql and can be a lot, what I have been doing is
that,
> using PHP, I create hidden fields with all the possible information that
> might be needed to fill the second drop down.
> 
> For example, the user chooses a bank from a drop down, and then a list of
> clients is displayed on the following drop down.  I use PHP to read all
> clients from all the banks and put that as hidden fields on the html page.
> It is very cumbersome.
> 
> I do not want to read the database (which changes dynamically) from
> javascript directly due to confidentiality and because a lot of care has
> been taken to create the appropriate  queries with checks and protect
misuse
> of the information using PHP.
> 
> My questions are:
> 1) Do people just normally use hidden fields to store possible information
> to fill the drop downs?
> 2) any suggestions?
> 
> Thanks in advance,
> Ramiro



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



[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