Advertisement
Guest User

Untitled

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