l208/search2.php

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <form action="search2.php" method="GET"> <input type="text" name="query" placeholder="Search..."> <button type="submit">Search</button> </form> <?php // Check if the search query is submitted if (isset($_GET['query'])) { // Retrieve the search query $search_query = $_GET['query']; $query1 = "SELECT * FROM studio WHERE naam LIKE '%$zoeken%' OR oprichtjaar LIKE '%$zoeken%'"; $result1 = mysqli_query($db, $query1); if($result1 && mysqli_num_rows($result1) > 0) { $row1 = mysqli_fetch_array($result1); $stid = $row1['studioid']; //Doorsturen naar dierdetails met gekregen dierid header("Location: studiodetails.php?studioid=$stid"); exit(); } $search_results = array( array('title' => 'Result 1', 'url' => 'studiodetails.php', 'description' => 'Description of result 1'), array('title' => 'Result 2', 'url' => 'result2.php', 'description' => 'Description of result 2'), // Add more search results here if needed ); //Controleren of er resultaten zijn // Display search results echo "<h2>Search Results for '$search_query':</h2>"; if (count($search_results) > 0) { echo "<ul>"; foreach ($search_results as $result) { echo "<li><a href='{$result['url']}'>{$result['title']}</a><p>{$result['description']}</p></li>"; } echo "</ul>"; } else { echo "No results found."; } } else { // If no search query is submitted, display a message or redirect to homepage echo "Please enter a search query."; } ?> </body> </html>

Resultaat

Made by Thijs Aarnoudse