Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <form action="insert.php" method="post">
- CodiceStanza:<input type="text" name="codice"><br>
- Tipologia:<input type="text" name="tipologia"><br>
- Climatizzatore:<input type="text" name="climatizzatore"><br>
- Cucina:<input type="text" name="cucina"><br>
- NumeroLetti:<input type="text" name="numeroletti"><br>
- <input type ="submit" name="submit" value="Inserisci">
- </form>
- <?php
- $host="localhost";
- $username="username";
- $password="password";
- $db_nome="database";
- // connessione al server
- mysql_connect($host, $username, $password) or die('Impossibile connettersi al server: ' . mysql_error());
- // accesso al database
- mysql_select_db($db_nome) or die ('Accesso non riuscito: ' . mysql_error());
- if(isset($_POST['submit'])){
- $codice = $_POST ['codice'];
- $tipologia= $_POST ['tipologia'];
- $climatizzatore = $_POST ['climatizzatore'];
- $cucina = $_POST ['cucina'];
- $numeroletti = $_POST ['numeroletti'];
- // comando SQL
- $sql =" UPDATE Stanza SET Tipologia = '$tipologia', Climatizzatore = $climatizzatore, ...
- WHERE Codice = $Codice;
- if (mysql_query($sql)) {
- echo "Aggiunto correttamente";
- } else {
- echo "Errore nell'inserimento: " . mysql_error();
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement