0byt3m1n1
Path:
C:
/
wamp64
/
www
/
Crops
/
[
Home
]
File: pests.php
<!DOCTYPE html> <html> <head> <title>Crop Details</title> <style> body { font-family: Arial, sans-serif; margin: 20px; } h1 { color: #333; text-align: center; } form { margin-bottom: 20px; } label { font-weight: bold; } select { padding: 8px; font-size: 16px; } input[type="submit"] { padding: 10px 20px; font-size: 18px; background-color: #333; color: #fff; border: none; cursor: pointer; } .crop-details { border: 1px solid #ccc; padding: 20px; margin-bottom: 20px; } .crop-details h2 { color: #333; } .crop-details p { margin: 10px 0; } .crop-details img { max-width: 100%; } .no-results { color: #333; text-align: center; margin-bottom: 20px; } </style> </head> <body> <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "crops"; $conn = new mysqli($servername, $username, $password, $dbname); if (isset($_POST['submit'])) { $selectedCrop = $_POST['crop']; // Get the selected crop from the drop-down menu // Construct the SELECT query to retrieve the details based on the selected crop $selectQuery = "SELECT Name,Pests, Psymptom, p_mng, img4 FROM crop WHERE Name = '$selectedCrop'"; // Execute the query $result = mysqli_query($conn, $selectQuery) or die(mysqli_error($conn)); // Display the results if (mysqli_num_rows($result) > 0) { echo "<html>"; echo "<head>"; echo "<style>"; echo "body {"; echo " display: flex;"; echo " justify-content: center;"; echo " align-items: center;"; echo " min-height: 100vh;"; echo " background-color: #d3f5a4;"; echo "}"; echo ".container {"; echo " max-width: 1000px;"; echo " background-color: #fff;"; echo " padding: 20px;"; echo " border-radius: 8px;"; echo "}"; echo "</style>"; echo "</head>"; echo "<body>"; echo "<div class='container'>"; while ($row = mysqli_fetch_assoc($result)) { echo "<h2> Details of" . $row['Name'] . "</h2>"; echo "<p><strong>PESTS:</strong> " . $row['Pests'] . "</p>"; echo "<p><strong>Symptoms:</strong> " . $row['Psymptom'] . "</p>"; echo "<p><strong>Management:</strong> " . $row['p_mng'] . "</p>"; echo "<p><strong>Image:</strong></p>"; echo "<img src='images/" . $row['img4'] . "' alt='Crop Image'>"; } echo "</div>"; echo "</body>"; echo "</html>"; } else { echo "No results found."; } } ?> </body> </html>