html - Call php file to return an array, and load it into a combo box -


i have index.php. want call function in load_data.php return array. want load array combox box on index.php. can me started on this? i'm brand new php , trying head around it.

you can use similar this:

load_data.php

function get_data() {     // may want load data db     // hint     return array('key1' => 'value 1', 'key2' => 'value 2'); } 

and in main file:

<select name="myselect">     <?php     include 'load_data.php';     $data = get_data();     foreach($data $key => $value) {         echo '<option value="'.$key.'">'.$value.'</option>';     }     ?> </select> 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -