Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <html>
  2. <body>
  3. <form action="insert.php" method="post">
  4. CodiceStanza:<input type="text" name="codice"><br>
  5. <input type ="submit" name="submit" value="Elimina">
  6. </form>
  7.  
  8. <?php
  9. $host="localhost";
  10. $username="username";
  11. $password="password";
  12. $db_nome="database";
  13. // connessione al server
  14. mysql_connect($host, $username, $password) or die('Impossibile connettersi al server: ' . mysql_error());
  15. // accesso al database
  16. mysql_select_db($db_nome) or die ('Accesso non riuscito: ' . mysql_error());
  17.  
  18. if(isset($_POST['submit'])){
  19.     $codice = $_POST ['codice'];
  20. // comando SQL
  21. $sql =" DELETE FROM Stanza WHERE Codice = $Codice";
  22. if (mysql_query($sql)) {
  23. echo "Rimosso correttamente";
  24. } else {
  25. echo "Errore nell'inserimento: " . mysql_error();
  26. }
  27. }
  28. ?>
  29. </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement