php code for multiple search box after connecting to mysql [closed]

So you can try change it to something like this:

<form method="post" action="example.php" id="searchform">
    <input type="text" name="keyword">
    <input type="submit" name="submit" value="submit">
</form>


if(isset($_POST['submit'])){
    $name=$_POST['keyword'];
    $statement = $myconnection->prepare("SELECT * FROM OL_trans  WHERE (ort LIKE '%$name%') OR (plz LIKE '%$name%') OR (vorname LIKE '%$name%')");
    $statement->execute();
    $key = $statement->fetchall();
    foreach($key as $value){
        echo '<br/>'.$value['vorname'].
            ' - '.$value['nachname'].
            ' - '.$value['strasse'].
            ' - '.$value['plz'].
            ' - '.$value['ort'].
            ' - '.$value['email'].
            ' - '.$value['telefon'].
            ' - '.$value['mobil'].'<br/><br/>';
    }
}
else{
    echo"enter correct name again";
}

Leave a Comment