Hey
Have 2 issues:
- How do I correct the image size…both should be equal once uploaded.
- The image uploads perfectly but username and title doesnt show. Ive placed the ECHO command in my code but it only works for the image. Here is my code:
<form name="frmImage" enctype="multipart/form-data" action="" method="post" class="frmImageUpload">
<label>Upload Image File:</label><br/>
<input name="userImage" type="file" class="inputFile" />
<textarea name="comments" id="comments" style="font-family:sans-serif;font-size:1.2em;">
</textarea>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<input type="submit" value="Submit" name="submit">
</form>
</div>
</div>
</div>
</div>
<br>
<br>
<br>
<br>
<div class="row row-cols-1 row-cols-md-2 g-4">
<?php
require_once "db.php";
$sql = "SELECT imageId FROM output_images ORDER BY imageId DESC";
$result = mysqli_query($conn, $sql);
// Loop thru comments and display all of them
while($row = mysqli_fetch_array($result)) {
printf("%s (%s)\n", $row["username"], $row["comment"],$row["imageId"]);
?>
<div class="row">
<a href="pro.php">
<div class="card">
<img src="imageView.php?image_id=<?php echo $row["imageId"]; ?>" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title"><?php echo (int)$_POST['username']; ?> </h5>
<p class="card-text"><?php echo (int)$_POST['comment']; ?> </p>
</div>
I appreciate the help