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
| <!DOCTYPE html>
<html>
<head>
<meta autor="George" charset='utf-8'>
<link rel="stylesheet" href="style">
<script>
</script>
<style>
</style>
<title>PHP Tirage au sort</title>
</head>
<body>
<H3> Tirage au sort </H3>
<form action="" method="post">
<input type="text" name="name" class="newname" placeholder="Insérer un nom">
</br>
</br>
<input type="submit" name="ajouter" id="ajouter" value="Ajouter participant">
<!--<input type="submit" name="loterie" id="loterie" value="Tirer au sort">-->
<?php
?>
</form>
</br>
<?php
$errors = [];
try
{
$connection = new PDO('mysql:host=localhost;dbname=MichelAugustin;charset=utf8','root','root');
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
$reponse = $connection->query('SELECT * FROM NameTable');
while ($donnees = $reponse->fetch())
{
echo $donnees['name'] . '<br />';
}
if(isset($_GET["ajouter"]))
{
$nom= $_GET["name"]
mysql_query("INSERT INTO 'NameTable' ('name') VALUES ('$_POST[name]')");
echo "Succes";
}
?>
</body>
</html> |
Partager