I wanted to create a search bar, Final.php is a display page for every event the user has inputted into the database but I want to add a search bar to query the list to find the result they want faster (the event names and four scores for each team). I don't understand where I have gone wrong, I hope someone can help.
<?php
$con = mysqli_connect("localhost", "id5052875_signuplogin", "Meganruby2") or die("cannot connect");
mysqli_select_db($con, "id5052875_signuplogin") or die ("couldnt connect");
$output = '';
    //collect
if (isset($_POST['search'])) {
    $searchq = $_POST['search'];
    $searchq = preg_replace("#[^0-9a-z]#i","",$searchq);
    print("$searchq");
    $query = mysqli_query($con, "SELECT * FROM event WHERE event name LIKE '%$searchq%'") or die("could not search");
    $count = mysqli_num_rows($query);
    echo($searchq);
    if($count == 0 ) {
        $output = 'There was no search';
    }else {
        while($row = mysqli_fetch_array($query)) {
            $event = $row['event name'];
            $num1 = $row['Score1'];
            $num2 = $row['Score2'];
            $num3 = $row['Score3'];
            $num4 = $row['Score4'];
            $output .= '<div> '.$event.' '.$num1.' '.$num2.' '.$num3.' '.$num4.'</div>';
            }
        }
    }
?>    
<form action="Final.php" method="post">
    <input type = "text" name = "search" placeholder = "search for event.."/>
    <input type = "submit" value = "search"/>
</form>
 
    