Skip to content

Commit

Permalink
last
Browse files Browse the repository at this point in the history
  • Loading branch information
valooj committed Dec 7, 2012
1 parent aaab5a1 commit c99abb4
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 66 deletions.
2 changes: 1 addition & 1 deletion article.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

while ($data = mysql_fetch_assoc($req)) {
if (isset($_GET["ID"])==$bdd[id]) {
echo 'Région: $bdd[region]<br/>Description: $bdd[description]<br/> Thème: $bdd[theme]<br/> <img src=$bdd[image]><br/>';
echo 'Région: $bdd[region]<br/>Description: $bdd[description]<br/> Thème: $bdd[theme]<br/> ';
}
}
?>
Expand Down
120 changes: 59 additions & 61 deletions creationArticle.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div id="content"> <!-- code destiné au corps du site -->

<form method="post" action="traitement.php" id="form">
<form method="post" id="form">

<?php
try {
Expand All @@ -19,54 +19,54 @@
<label for="region">Region: </label>
<?php
while ($donnees = $reponse->fetch()) {
echo '<optgroup label="', $donnees['nom'], '">', $donnees2['nom'], '</option>';
$reponse2 = $bdd->query('SELECT * FROM `departement` ORDER BY `numero`');
echo '<optgroup label="', $donnees['region'], '">', $donnees['region'], '</optgroup>';
$reponse2 = $bdd->query('SELECT * FROM `article`');
while ($donnees2 = $reponse2->fetch()) {
echo '<option value="', $donnees2['nom'], '">', $donnees2['nom'], '</option>';
echo '<option value="', $donnees2['departement'], '">', $donnees2['departement'], '</option>';
}
}
?>
<p class="first">
théme:<br />
<input type="radio" name="theme" value="evenement" id="evenement" />
<label for="evenement">Evènement</label>
<br />
théme:<br />
<input type="radio" name="theme" value="evenement" id="evenement" />
<label for="evenement">Evènement</label>
<br />

<br />
<input type="radio" name="theme" value="gastronomie" id="gastronomie" />
<label for="gastronomie">Gastronomie</label>
<br />
<br />
<input type="radio" name="theme" value="monument" id="monument" />
<label for="monument">Evènement</label>
<br />
<br />
<input type="radio" name="theme" value="musee" id="musee" />
<label for="musee">Musée</label>
<br />
<br />
<input type="radio" name="theme" value="Lieux" id="Lieux" />
<label for="Lieux">Lieux</label>
<br />
<br />
<input type="radio" name="theme" value="act_sport" id="act_sport" />
<label for="act_sport">Activités sportives</label>
<br />
</p>
<p class="first">
age:<br />
<input type="radio" name="age" value="enfant" id="enfant" />
<label for="enfant">Enfant</label>
<br />
<br />
<input type="radio" name="theme" value="gastronomie" id="gastronomie" />
<label for="gastronomie">Gastronomie</label>
<br />
<br />
<input type="radio" name="theme" value="monument" id="monument" />
<label for="monument">Evènement</label>
<br />
<br />
<input type="radio" name="theme" value="musee" id="musee" />
<label for="musee">Musée</label>
<br />
<br />
<input type="radio" name="theme" value="Lieux" id="Lieux" />
<label for="Lieux">Lieux</label>
<br />
<br />
<input type="radio" name="theme" value="act_sport" id="act_sport" />
<label for="act_sport">Activités sportives</label>
<br />
</p>
<p class="first">
age:<br />
<input type="radio" name="age" value="enfant" id="enfant" />
<label for="enfant">Enfant</label>
<br />

<br />
<input type="radio" name="age" value="ados" id="gastronomie" />
<label for="ados">Ados</label>
<br />
<br />
<input type="radio" name="age" value="adultes" id="ados" />
<label for="ados">adultes</label>
<br />
<br />
<input type="radio" name="age" value="ados" id="gastronomie" />
<label for="ados">Ados</label>
<br />
<br />
<input type="radio" name="age" value="adultes" id="ados" />
<label for="ados">adultes</label>
<br />
</p>

<label for="Description">Description</label> <textarea name="description" id="description"
Expand All @@ -76,26 +76,24 @@

</form>

<?php

if(isset($_POST['valider'])){
//On récupère les valeurs entrées par l'utilisateur :
$region = htmlspecialchars($_POST['region']);
$theme = htmlspecialchars($_POST['theme']);
$age = htmlspecialchars($_POST['age']);
$description = htmlspecialchars($_POST['description']);

//On prépare la commande sql d'insertion
$sql = 'INSERT INTO article VALUES("","' . $region . '","' . $theme . '","' . $age . '","' . $description . '")';
<?php
if (isset($_POST['valider'])) {
//On récupère les valeurs entrées par l'utilisateur :
$region = htmlspecialchars($_POST['region']);
$theme = htmlspecialchars($_POST['theme']);
$age = htmlspecialchars($_POST['age']);
$description = htmlspecialchars($_POST['description']);

/* on lance la commande (mysql_query) et au cas où,
on rédige un petit message d'erreur si la requête ne passe pas (or die)
(Message qui intègrera les causes d'erreur sql) */
mysql_query($sql) or die('Erreur SQL !' . $sql . '<br />' . mysql_error());
//On prépare la commande sql d'insertion
$sql = 'INSERT INTO article VALUES("","' . $region . '","' . $theme . '","' . $age . '","' . $description . '")';

// on ferme la connexion
mysql_close();
}
/* on lance la commande (mysql_query) et au cas où,
on rédige un petit message d'erreur si la requête ne passe pas (or die)
(Message qui intègrera les causes d'erreur sql) */
mysql_query($sql) or die('Erreur SQL !' . $sql . '<br />' . mysql_error());

?>
// on ferme la connexion
mysql_close();
}
?>
</div>
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<head>
<link rel="stylesheet" type="text/css" media="all" href="style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-6">
<title>Nom du site éé</title>
<title>La Boussole Française</title>
</head>
<body>
<?php
Expand Down
6 changes: 3 additions & 3 deletions rechercheClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<select name="departement" id="departement">
<?php
while ($donnees = $reponse->fetch()) {
echo '<optgroup label="', $donnees['nom'], '">', $donnees['nom'], '</option>';
$reponse2 = $bdd->query('SELECT * FROM `departement` ORDER BY `numero`');
echo '<optgroup label="', $donnees['region'], '">', $donnees['region'], '</optgroup>';
$reponse2 = $bdd->query('SELECT * FROM `article`');
while ($donnees2 = $reponse2->fetch()) {
echo '<option value="', $donnees2['nom'], '">', $donnees2['nom'], '</option>';
echo '<option value="', $donnees2['departement'], '">', $donnees2['departement'], '</option>';
}
}
?>
Expand Down

0 comments on commit c99abb4

Please sign in to comment.