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>
You have to remove the = in <= in the for condition