0

I'm getting this error and i don't know why, especially since I found the code here on stack,

Hopefully this is something easily explain/fixable. I'm working on a beginning practice project and am currently learning how to use php to add all the images in a folder.

So, I have fpull.php with the code where the problem supposively lies, Line 9;

<?php 

$files = glob("../uploads/*.*");

for($x = 0; $x <= count($files); $x++){

    $image = $files[$x];
// ^ the line above is line 9 ^ --------------------

    echo '<img src="'.$image .'"/>'."<br/>";
}


?>

It wouldn't be a problem but it throws an error on my page,

Here is the index.php file that is included into.

<html>

<head>
<?php include('header.php'); ?>
<title>MOTIVATION</title>

</head>

<body>
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post" class="motivcall">

<label for="motivation">MotiVATOR</label>
<input type="text" size='50' name="motivation" id="motivation" placeholder="Enter your dose of Motivation">
<select name="dose">
    <option name="Oz">Oz</option>
    <option name="mg">Mg</option>
    <option name="mg">Kg</option>
    <option name="mg">Lb</option>
</select>


<input type="submit" name="submit">




<?php

if(isset($_POST["submit"])){
   $motiv = $_POST['motivation'];

    if(isset($motiv)){

        for($x =0; $x <= $motiv; $x++){
    $vator = "You're Gonna Make It";
            echo "<h3>".$vator."</h3>";
     $actt = "Now Go Out There and Kick Some Ass";


        }

        echo " <h2>".$actt."</h2>";
}

}
?>
</form>

<br>

<?php

include('fpull.php');

?>

</body>
</html> 
av17
  • 107
  • 10

1 Answers1

1

You have to remove the = in <= in the for condition

kiks73
  • 3,718
  • 3
  • 25
  • 52
  • ah nice. Would you know why I'm still having a broken image icon after all of my images are displayed however? – av17 May 25 '14 at 06:15
  • I have something in my inbox 13 minutes ago that was a reply to here but it's not showing up, in otherwords I cannot read it,mind resending it? Anyone else know where he was going? $folder = "../uploads/"; foreach (newDirectoryIterator($folder) as $fileinfo){e... – av17 May 25 '14 at 07:18
  • @av17 it was my answer before that I noticed the real problem. You can find a similar answer here: http://stackoverflow.com/questions/19193336/google-app-enginephp-glob-function – kiks73 May 25 '14 at 13:41