0byt3m1n1
Path:
C:
/
wamp64
/
www
/
crop
/
Crops
/
[
Home
]
File: cnd.php
<?php session_start(); $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 $nutri=$_POST['nutrient']; $dis=$_POST['disease']; // Construct the SELECT query to retrieve the details based on the selected crop $selectQuery = "SELECT Name, Scientific_Name, Family, img,Nutrient, Symptoms, Management, img2,Dicease, d_symptom, D_mng, img3 FROM crop WHERE Name = '$selectedCrop' &&Nutrient='$nutri' && Dicease='$dis' "; // 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>Name:</strong> " . $row['Name'] . "</p>"; echo "<p><strong>Scientific Name:</strong> " . $row['Scientific_Name'] . "</p>"; echo "<p><strong>Family:</strong> " . $row['Family'] . "</p>"; echo "<p><strong>Image:</strong></p>"; echo "<img src='images/" . $row['img'] . "' alt='Crop Image'>"; echo "<h2>Nutrient Details</h2>"; echo "<p><strong>Nutrient Name:</strong> " . $row['Nutrient'] . "</p>"; echo "<p><strong>Symptoms:</strong> " . $row['Symptoms'] . "</p>"; echo "<p><strong>Management:</strong> " . $row['Management'] . "</p>"; echo "<img src='images/" . $row['img2'] . "' alt='Crop Image'>"; echo "<h2>Details of Disease</h2>"; echo "<p><strong>Disease:</strong> " . $row['Dicease'] . "</p>"; echo "<p><strong>Symptoms:</strong> " . $row['d_symptom'] . "</p>"; echo "<p><strong>Management:</strong> " . $row['D_mng'] . "</p>"; echo "<p><strong>Image:</strong></p>"; echo "<img src='images/" . $row['img3'] . "' alt='Crop Image'>"; } echo "</div>"; echo "</body>"; echo "</html>"; } else { echo "No results found."; } } ?>