← Share another text

Shared on Droptext

Untitled text

Posted on 2026-11-173 views
<?php require_once 'conectare.php'; $mesaj = ""; if (isset($_POST['adauga'])) { $nr = $_POST['nr']; $titlu = $_POST['titlu']; $autor = $_POST['autor']; $editura = $_POST['editura']; $an = $_POST['an']; $isbn = $_POST['isbn']; $exemplare = $_POST['exemplare']; $sql = "INSERT INTO EVIDENTA_CARTI (NR_CRT, TITLU_CARTE, AUTOR_CARTE, EDITURA, ANUL_APARITIEI, COD_ISBN, NR_EXEMPLARE) VALUES (:nr, :titlu, :autor, :editura, :an, :isbn, :exemplare)"; $stid = oci_parse($conn, $sql); oci_bind_by_name($stid, ':nr', $nr); oci_bind_by_name($stid, ':titlu', $titlu); oci_bind_by_name($stid, ':autor', $autor); oci_bind_by_name($stid, ':editura', $editura); oci_bind_by_name($stid, ':an', $an); oci_bind_by_name($stid, ':isbn', $isbn); oci_bind_by_name($stid, ':exemplare', $exemplare); if (oci_execute($stid, OCI_NO_AUTO_COMMIT)) { oci_commit($conn); $mesaj = "Cartea a fost adaugata cu succes!"; } else { $e = oci_error($stid); oci_rollback($conn); $mesaj = "Eroare: " . $e['message']; } oci_free_statement($stid); } ?> <!DOCTYPE html> <html lang="ro"> <head> <meta charset="UTF-8"> <title>Adaugare carte</title> <link rel="stylesheet" href="stil.css"> </head> <body> <h2>Adaugarea unei carti noi</h2> <form method="POST" action="adaugare.php"> <label>Numar curent:</label> <input type="number" name="nr" required> <label>Titlul cartii:</label> <input type="text" name="titlu" required> <label>Autorul:</label> <input type="text" name="autor"> <label>Editura:</label> <input type="text" name="editura"> <label>Anul aparitiei:</label> <input type="number" name="an"> <label>Cod ISBN:</label> <input type="text" name="isbn"> <label>Numar exemplare:</label> <input type="number" name="exemplare" min="0" required> <button type="submit" name="adauga"> Adauga carte </button> </form> <p><?php echo htmlspecialchars($mesaj); ?></p> </body> </html> <?php oci_close($conn); ?>