Angelo Zanetti írta:
Hi all,
I am looking at options for creating a dynamic dropdown list.

Ok here is the scenario:
All values in the dropdown list (select/option field) are coming from the
database.

So there will be 2 dropdown lists. First one say gets (for example) a list
of cars,
Then once the car is choosen the second list is populated with the list of
models for the car choosen.

I would like to know if its possible to do this without posting as well as
without the use of JS. I have seen js examples where the values are all
stored in arrays.


without JS it is not possible, unless you put a submit button next to the first select


This is not desireable as I will be getting the values from the the DB using
PHP, unless I can write the JS values to the arrays using PHP? Also not sure
of that.

sure you can generate the JS arrays with php. just echo out the necessary js, like:

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


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.

I would go for ajax, if possible, but I don't know if it works on wap or not

greets,
Zoltán Németh


Please advise.

Thanks in advance

Angelo

Web: http://www.elemental.co.za





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

Reply via email to