RE: [PHP] populate select box with contents of a file?

From: Date: Thu, 08 Mar 2001 18:28:23 +0000
Subject: RE: [PHP] populate select box with contents of a file?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43057@lists.php.net to get a copy of this message
Thanks, that works great. Jerry Lake - jerryl@europa.com Web Designer Europa Communications - http://www.europa.com Pacifier Online - http://www.pacifier.com -----Original Message----- From: Joe Sheble (Wizaerd) [mailto:JustForMailingLists@wizaerd.com] Sent: Thursday, March 08, 2001 10:13 AM To: php-general@lists.php.net Subject: RE: [PHP] populate select box with contents of a file? <?php $handle=opendir('.'); echo "<select name=image_url>"; while (false!==($file = readdir($handle))) { // new code here $cExt = explode( ".", $file ); // and here if ($file != "." && $file != ".." && ( strtolower( $cExt[1] ) == "jpg" ) { echo "<option "; echo "value=".$file.">"; echo $file; echo "</option>\n\r"; } } echo "</select>"; closedir($handle); ?> At 10:04 AM 3/8/01 -0800, Jerry Lake wrote: >Ok, I am using this modified code from the >manual. It works great, but how do I modify >it further to only show .jpg files ? > ><snip> ><?php >$handle=opendir('.'); > echo "<select name=image_url>"; >while (false!==($file = readdir($handle))) { > if ($file != "." && $file != "..") { > echo "<option "; > echo "value=".$file.">"; > echo $file; > echo "</option>\n\r"; > } >} > echo "</select>"; >closedir($handle); >?> ></snip > >Jerry Lake - jerryl@europa.com >Web Designer >Europa Communications - http://www.europa.com >Pacifier Online - http://www.pacifier.com > > >-----Original Message----- >From: Sean R. Bright [mailto:elixer@erols.com] >Sent: Wednesday, March 07, 2001 4:50 PM >To: 'Jerry Lake'; 'Henrik Hansen'; 'php general' >Subject: RE: [PHP] populate select box with contents of a file? > > > >Take a look at dir() and readdir(). Those along with echo() should help you >out. > >Sean > > > -----Original Message----- > > From: Jerry Lake [mailto:jerryl@europa.com] > > Sent: Wednesday, March 07, 2001 7:40 PM > > To: Henrik Hansen; php general > > Subject: [PHP] populate select box with contents of a file? > > > > > > I would like to be able to populate > > the options of a select box with the > > contents of my images directory online > > so I can select the image I want to > > go with the form I am filling out. > > what functions do I need to look into > > to figure this one out? > > > > Jerry Lake - jerryl@europa.com > > Web Designer > > Europa Communications - http://www.europa.com > > Pacifier Online - http://www.pacifier.com > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: > > php-list-admin@lists.php.net > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#43057) next »