'; if ($label != '') $ouput .= ' '; $ouput .= ' '; return $ouput; } /* ----------------------------------------------------------------------------- Echos eturn_option_select ----------------------------------------------------------------------------- */ function echo_option_select($name, $list, $label, $v) { echo return_option_select($name, $list, $label, $v); } /* ------------------------------------------------------ Create a page and test the echo_option_select functions ------------------------------------------------------ */ require_once('site_core.php'); require_once('site_db.php'); // Create the HTML head and container echo_head('Test 4'); echo '
'; // Create an associateve array $colors['#f00'] = 'red'; $colors['#0f0'] = 'green'; $colors['#00f'] = 'blue'; $colors['#ff0'] = 'yellow'; $colors['#f0f'] = 'purple'; // Dump the array echo '
';
var_dump($colors);
echo '
'; // Test the function with the array echo_option_select('color', $colors,'Pick a Color'); echo '
'; // Get the pageid and title of all pages $result = run_query("SELECT pageid, title FROM pages"); // Transform it into an associative array $pages = array(); while ($row = $result->fetch_assoc()) { $pages[ $row['pageid'] ] = $row['title']; } // Dumpt the array echo '
';
var_dump($pages);
echo '
'; // Test the function with the array echo_option_select('pageid', $pages,'Pick a Page','usa'); echo '
'; echo_foot(); ?>