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 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| <?php
$numero=$_POST['numero'];
$titre=$_POST['titre'];
$decription=$_POST['description'];
$etat=$_POST['etat'];
$fini=$_POST['fini'];
if($numero&&$titre)
{
$pdo = new PDO([...]);
$result = $pdo->prepare('INSERT INTO table (numero, titre, decription, etat, fini) VALUES(:numero, :titre, :decription, :etat, :fini)');
$result->execute(array(
'numero' => $numero,
'titre' => $titre,
'decription' => $decription,
'etat' => $etat,
'fini' => $fini,
));
echo 'tp : ok';
unset($pdo);
}else {$msg2="Veuillez saisir tous les champs !";
}
}}
}else{
echo 'Erreur.';
die();}
?>
<html>
<head>
<meta charset="UTF-8">
<title>Créer</title>
</head>
<body>
<div style="
Text-align:center;
Width:90%;
Padding-top:20px;
Height:300px;
">
<br><br>
<?php
echo $msg2;
?>
<br><br>
<form method="POST" action="creer.php">
<p>Numéro :</p>
<input type="text" name="numero">
<p>Titre :</p>
<input type="text" name="titre">
<p>Description :</p>
<input type="text" name="description">
<p>État :</p>
<input type="text" name="etat">
<p>Fini :</p>
<input type="text" name="fini">
<br><br>
<input type="submit" value="Tp" name="submit">
</form> |
Partager