Re: dynamic pulldown list generation help

From: Date: Tue, 26 Feb 2002 14:20:52 +0000
Subject: Re: dynamic pulldown list generation help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-86240@lists.php.net to get a copy of this message
On Tuesday 26 February 2002 20:50, Andrew Slezak wrote: > Basically I am setting ls > array(). I want each item to be an option in > the array. I have have scoured for some time now and this is what I have > come up with, but it is not populating each file as an <option>? The > select box is just empty. I know this is an array because I have tested > with print_r. Stuck! > > Can someone tell me what I am doing wrong? > ------------------------------------------------ > <? > $shell_scripts=`ls -1 /sm_scripts|grep -v backup|grep -v outmail|grep -v > c_`; > $shell_scripts=rtrim($shell_scripts); > $arr1=split("\n", "$shell_scripts"); > //print_r($arr1); > > > echo "<p>"; > echo "<select name=test>"; > function generate_option_list($arr1, $set) { > reset($arr1); > while (list($key,$value) = each($arr1) ) { > {$var.="<option value='$key'>$value</option>";} > } return $var; > } > > echo "</select>"; > ------------------------------------------------ > ?> You've defined a function "generate_option_list", but you haven't called it! -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Somehow, the world always affects you more than you affect it. */

« previous php.general (#86240) next »