The HTML upload form:
<form action="InformationData.php" method="post" enctype="multipart/form-data">
<label >Barangay Certification</label>
<input name="BarangayCertification" type="file" id="exampleInputFile1">
<button type="Submit" name="Submit" value="Upload">Submit</button>
</form>
The InformationData.php
:
<?php
$conn = mysqli_connect("localhost", "root", "", "registration");
if($_POST['BarangayCertification']){
$BarangayCertification = $_POST['BarangayCertification'];
} else {
$BarangayCertification = "";
}
$sql = "INSERT INTO stakeholdersform (BarangayCertification) VALUES ($BarangayCertification);
?>
Code to show the image:
<?php
$conn = mysqli_connect("localhost", "root", "", "registration");
$informations = "SELECT * FROM stakeholderinformations";
$result = $conn->query($informations);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$BarangayCertification = $row['BarangayCertification'];
echo $BarangayCertification;
}
}
?>
I tried to echo it but nothing happens, but I can see the image in the database.