Re: string...

From: Date: Thu, 11 Apr 2002 18:12:32 +0000
Subject: Re: string...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-92628@lists.php.net to get a copy of this message
On Friday, April 12, 2002, at 01:50 AM, jas wrote:
Ok, I have tried all 3 examples and even tried a few variations that you have given me and so far nothing is getting displayed, is there a way to check for errors? here is the code I am working with:
What happens if you get rid of that eregi() function? Does it show you all of your files? If so, then the problem is the regex in your eregi().
// second selection for main image on main page $dir_name = "/path/to/images/directory/"; $dir = opendir($dir_name); $file_lost .= "<p><FORM METHOD=\"post\" ACTION=\"done.php3\" NAME=\"images\"> <SELECT NAME=\"images\">"; while ($file_names = readdir($dir)) { if ($file_names != "." && $file_names !=".." && eregi("^/*_[0-9]{4}\.jpg$", $file_name)) {
        ^^^^^^^^^^^^^^^^^^
This regex will match only files that obey the following rules: 1. may or may not start with a slash 2. next character must be an underscore 3. next 4 characters must be digits 4. next character must be a dot 5. next 3 characters must be "jpg" 6. case doesn't matter Are you sure you have files that meet the above 6 rules in your directory? If you don't, then nothing will be displayed. Are you sure that your "/path/to/directory" is a real path to a real directory? etc etc
$file_lost .= "<OPTION VALUE=\"$file_names\" NAME=\"$file_names\">$file_names</OPTION>"; } } $file_lost .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\"></FORM></p>"; closedir($dir);
Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com

« previous php.general (#92628) next »