- Dashboard
- Add About Us
Add About
0) {
echo '
Only one record allowed. Please update the existing record.
';
} else {
$allowed_extensions = ['jpg', 'jpeg', 'png', 'webp'];
$image_path = null;
// Handle single file upload
if (!empty($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
$imageno = $_FILES['file']['name'];
$extension = strtolower(pathinfo($imageno, PATHINFO_EXTENSION));
if (in_array($extension, $allowed_extensions)) {
$ran = rand(9999999, 99999999999);
$imagename = $ran . '.' . $extension;
$source = $_FILES['file']['tmp_name'];
$target = "uploads/" . $imagename;
move_uploaded_file($source, $target);
$image_path = $target;
} else {
echo 'Invalid image format. Allowed formats are .jpg, .jpeg, .png, .webp.
';
exit;
}
}
// Insert data into the database
$query = "INSERT INTO eltra_about (title, short_about, long_about, file) VALUES ('$title', '$short_about', '$long_about', '$image_path')";
$result = mysqli_query($link, $query);
if ($result) {
echo 'Added successfully.
';
} else {
echo 'Try again.
';
}
}
}
?>
All About
Deleted successfully.
';
} else {
echo 'Error deleting record.
';
}
}
?>
| Sr No. | Title | About Image | Action |
|---|---|---|---|
';
} else {
echo ' ';
}
?>
|
Edit |
';
}
?>