-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajouter.php
More file actions
47 lines (41 loc) · 1.25 KB
/
Copy pathajouter.php
File metadata and controls
47 lines (41 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
require 'config.php';
if($_SERVER['REQUEST_METHOD'] === "POST"){
$nom = $_POST["nom"];
$prenom = $_POST["prenom"];
$telephone = $_POST["telephone"];
$email = $_POST["email"];
$stmt = $pdo->prepare("INSERT INTO contacts(nom, prenom, telephone, email) VALUES(?, ?, ?, ?)");
$stmt->execute([$nom, $prenom, $telephone, $email]);
header("Location: index.php");
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gestion des contacts</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Ajouter de contact</h1>
<form method="POST">
<label for="">
Nom: <input type="text" name="nom" required>
</label><br>
<label for="">
Prenom: <input type="text" name="prenom" required>
</label><br>
<label for="">
Telephone: <input type="number" name="telephone">
</label><br>
<label for="">
Email: <input type="email" name="email">
</label><br>
<button type="submit">Enregistrer</button>
</form>
<a href="index.php">Retour</a>
</body>
</html>