Ajouter blibliotheque
This commit is contained in:
commit
4753980ce3
21
blibliotheque
Normal file
21
blibliotheque
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$pdo = new PDO("mysql:host=localhost;dbname=MaBibliotheque", "root", "");
|
||||
|
||||
if ($_POST && $_POST['titre'] && $_POST['auteur']) {
|
||||
$pdo->prepare("INSERT INTO livres (titre, auteur) VALUES (?, ?)")
|
||||
->execute([$_POST['titre'], $_POST['auteur']]);
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<form method="post">
|
||||
<input name="titre" placeholder="Titre" required><br><br>
|
||||
<input name="auteur" placeholder="Auteur" required><br><br>
|
||||
<button>Ajouter</button>
|
||||
</form>
|
||||
|
||||
<p><a href="index.php">Retour</a></p>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user