Re: why doesn't this work ?
| From: | Pooya Eslami | Date: | Sat, 17 Apr 2004 18:24:04 +0000 |
| Subject: | Re: why doesn't this work ? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183733@lists.php.net to get a copy of this message | ||
I took out the scrip tags and put in <?php in the beginning and ?> at the
end, but it returns this:
$file
"; } } closedir($handle); } echo "
"; ?>
Any ideas how to fix this?
"Daniel Clark" <dclark@nwlink.com> wrote in message
news:20040417180130.A4C1F702D5@smtp1.pacifier.net...
> I should have also said:
>
> Because it's missing the <?php and ?> tags, the web server isn't going to
run the code, but pass it back to the client browser.
>
>
> >>If I put the following script in a .php file it would work but if I put
it
> >>in an .html file doesn't work, why? script tag is only used in .html
file.
> >>
> >><script language = "php">
> >>echo "<ul>";
> >>if ($handle = opendir('.')) {
> >> while (false !== ($file = readdir($handle))) {
> >> if ($file != "." && $file != ".." &&
> >> eregi('\.html$', $file)) {
> >> echo "<li><a href=\"$file\"><font
> >> color=\"#CC0000\">$file</
> >>
> >>font></a></li><br>";
> >> }
> >> }
> >> closedir($handle);
> >>}
> >>