Hey
just learning to use php am trying to create a form were the user inputs a directory this is then passed to another form were the files in the directory are shown.
DirectoryScanForm :
<html>
<form action="DirectoryScanOutput.php" method="post">
<input type="text" size="45" name="directory"> <br>
<input type="submit" Value="Check directory">
</form>
</html>
DirectroyScanOutput:
<?php
$directory = $_POST['directory']; #assign value
if( $directory !=null )
{
$dirname = "$directory";
$dir = opendir( $dirname ) ;
while (false != ( $file = readdir( $dir ) ) )
{
if ( ( $file != "." ) and ( $file != ".." ) )
{
$file_list .= "<li>$file</li>";
}
}
closedir( $dir);
?>
<html><body>
<p>Files in <?php echo( $dirname ); ?> </p>
<ul>
<?php echo( $file_list ); ?>
</p></ul>
</body></html>
Keep getting the error, Parse error: parse error, unexpected $end in C:\xampplite\htdocs\Practice\DirectoryScan\DirectoryScanOutput.php on line 27
line 27 is the last line of the output form. been looking round and it says this is normally due to a missing } but i cant see were this error is coming from.
any help would be great am also not sure weather the directory variable needs the "" around it ($dirname = "$directory"😉 or not but have tried with both and it doesnt work
Thanks
Edit: i am using dreamweaver 8 to write the code and XAMPP if that makes a diffrence