Sto provando a costruire una searchbar con php e database mysql, solamente che non funziona e non so proprio perchè: vi lascio l'immagine della struttura della tabella, l'indirizzo e il codice.
Link= https://hard-questions.com/try/ggg.php
Link immagini: 1)https://i.snipboard.io/37J0Uu.jpg
2)https://i.snipboard.io/yeho3x.jpg
codice:<html> <head> <title>Search Bar using PHP</title> </head> <body> <form method="post"> <label>Search</label> <input type="text" name="search"> <input type="submit" name="submit"> </form> </body> </html> <?php $con = new PDO("mysql:host=sql300.epizy.com;dbname=epiz_24872058",'yLzTqP0MzhWpmNs',''); if (isset($_POST["submit"])) { $str = $_POST["search"]; $sth = $con->prepare("SELECT * FROM `search` WHERE Name = '$str'"); $sth->setFetchMode(PDO:: FETCH_OBJ); $sth -> execute(); if($row = $sth->fetch()) { ?> <br><br><br> <table> <tr> <th>Name</th> <th>Description</th> </tr> <tr> <td><?php echo $row->Name; ?></td> <td><?php echo $row->Description;?></td> </tr> </table> <?php } else{ echo "Name Does not exist"; } } ?>