Todd Cary wrote:
I am using an array to populate a drop-down and I would like to have the same value in the key as the value. Using the following, the key is 0,1,2,3...etc. How can I correct that?

what is there to correct - you are telling me that the value of $file show up as a string and then magically it becomes an integer (but just while you are designating the key)


listen you've just shown us a simple loop to stuff some file/dir names into an array where by the file/dir name is the assoc. key as well as the value of any given item in said array - WHERE THE F*** IS THE DROPDOWN RELATED CODE?


$file_list = array(); $dir = opendir($doc_dir); while (false !== ($file = readdir($dir))) { if (($file != ".") && ($file != "..")) $file_list[$file] = $file; <---------------<<<<< }

what happens if you place the following right after the code you mention (just to prove that what you say about the key is wrong):


echo '<pre>';
print_r($file_list);
echo '</pre>';


Todd


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



Reply via email to