Don Alexander Eckford's Hubble Telescope Images
Please enter a number between 1 and 10.
Please enter a number between 1 and 10.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hubble Space Images</title>
<?php
// Include header file (likely containing HTML structure and other common elements)
include('includes/header.php');
?>
<body>
<h1>Don Alexander Eckford's Hubble Telescope Images</h1>
<form action="DeepSpace.php" method="POST">
<label for="image_count">How many images would you like to see?</label>
<input type="number" id="image_count" name="image_count" min="1" max="10">
<button type="submit">Submit</button>
</form>
<?php
// Get the number of images the user wants to display
$image_count = isset($_POST['image_count']) ? (int)$_POST['image_count'] : 0;
// Hubble Telescope images (URLs or image paths)
$images = [
"../images/AGCarinae.png",
"../images/CircinusGalaxy.png",
"../images/CygnusLoop.png",
"../images/DwarfIrregularGalaxyUGC8091.png",
"../images/EagleNebulaPillarsOfCreation.png",
"../images/GalaxyAM1054-325.png",
"../images/GalaxyUGC12158withasteroidphotobomb.jpg",
"../images/GravitationalLensSDSSJ1004.jpg",
"../images/HorseheadNebula.png",
"../images/Hubble_Ullyses.png"
];
// Decision: If image_count is within a valid range, display images
if ($image_count > 0 && $image_count <= 10) {
echo "<h1>Displaying $image_count Hubble Telescope Images</h1>";
// Loop through the number of images to display
for ($i = 0; $i < $image_count; $i++) {
echo "<div style='margin: 20px;'>
<img src=$images[$i] alt='Hubble Image' style='width:300px;height:auto'>
</div>";
}
} else {
// Decision: If the input is invalid, display an error
echo "<p>Please enter a number between 1 and 10.</p>";
}
// Include footer file (likely containing closing HTML tags or common footer elements)
include('includes/footer.php');
?>