Vous êtes sur la page 1sur 2

<html>

<head>
<meta charset="utf-8">

<title>test</title>

</head>
<body>

<?php

$conn=mysqli_connect("localhost","root","","films");

if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}

// ajout
if ( isset($_POST['titre']) && isset($_POST['annee']) &&
isset($_POST['nom']) && isset($_POST['prenom']) &&
isset($_POST['annee_naissance']) )
{
$sql = "INSERT INTO films (titre, annee, nom, prenom, annee_naissance)
VALUES ('".$_POST["titre"]."','".$_POST["annee"]."','".$_POST["nom"]."','".
$_POST["prenom"]."','".$_POST["annee_naissance"]."')";

$result = mysqli_query($conn,$sql);
}

?>

<form action="ajouter.php" method="post">

<label id="first"> Titre</label><br/>


<input type="text" name="titre"><br/>

<label id="first"> Année</label><br/>


<input type="text" name="annee"><br/>

<label id="first">Nom réalisateur</label><br/>


<input type="text" name="nom"><br/>

<label id="first">Prenom réalisateur</label><br/>


<input type="text" name="prenom"><br/>

<label id="first">Année naissance</label><br/>


<input type="text" name="annee_naissance"><br/>

<button type="submit" name="Ajouter">Ajouter</button>


<input type="reset" value="Effacer " /><br /><br />

<a href="index.html">Retour a la page d'accueil</a>


</form>

</body>
</html>

Vous aimerez peut-être aussi