Forums

Fill Dropdown from Database

Systemcheck231982 10 Dec, 2013
Ive read many Topics the last days but i dont found any working Tutorial to fill my dropdown from database.

1. I have a table called: #__chronoforms_termine
2. in this table i have many records named input_datetime_1 and input_text_2

now i want to fill a dropdown with these values.... but.. how?
i dont know how i can do this.
Systemcheck231982 10 Dec, 2013
I do this you can see in the attachement..

but the dropdown is empty.
Systemcheck231982 11 Dec, 2013
Validation Errors: 
Array
(
)
Debug Data
db_multi_record_loader
SELECT `input_datetime_1`.* FROM `ab_chronoforms_termine` AS `input_datetime_1


The array is filled but my dropdown box is empty again..
Systemcheck231982 11 Dec, 2013
Now it looks like this:

Array
(
    [datetime] => Array
        (
            [0] => Array
                (
                    [input_datetime_1] => 13-12-2013 18:00:16
                )

            [1] => Array
                (
                    [input_datetime_1] => 
                )

            [2] => Array
                (
                    [input_datetime_1] => 14-12-2013 18:00:31
                )

            [3] => Array
                (
                    [input_datetime_1] => 21-12-2013 18:00:27
                )

        )

)
Validation Errors: 
Array
(
)
Debug Data
db_multi_record_loader
SELECT `input_datetime_1` FROM `ab_chronoforms_termine` AS `datetime`


and the following is the code from the wizard Code Section
<?php
						$options_data = $form->get_array_value($form->data, explode(".", "datetime"));
						if(!is_null($options_data) && is_array($options_data)){
							foreach($options_data as $option_data){
								if(isset($option_data["datetime"]) && isset($option_data["text"])){
									echo '<option value="'.$option_data["datetime"].'"'.(in_array($option_data["datetime"], array (
  0 => '',
)) ? ' selected="selected"' : "").">".$option_data["text"]."</option>\n";
								}
							}
						}
						?>
Systemcheck231982 12 Dec, 2013
Thank you very much. this is the way which is working.

my mistakes were the value- & text key entries.
This topic is locked and no more replies can be posted.