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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
<?php
include("identification.inc.php");
include("variables.inc.php");
$liendb = mysql_connect ($bddserver, $bddlogin, $bddpassword);
mysql_select_db ($bdd);
if ($_POST['action'] == "maj")
{
if (empty($_POST['nom']))
die ("erreur");
$sql = "UPDATE pdv SET date_demande = '".$_POST['date_demande']."',
nom = '".$_POST['nom']."',
prenom = '".$_POST['prenom']."',
email = '".$_POST['email']."',
ville = '".$_POST['ville']."',
cp = '".$_POST['cp']."',
mariage = '".$_POST['mariage']."',
newsletter = '".$_POST['newsletter']."',
contenu = '".$_POST['contenu']."',
commande = '".$_POST['commande']."'
WHERE idpdv = '".$_POST['id']."'";
mysql_query ($sql);
echo "Mise à jour effectuée";
}
elseif ($_POST['action']=="suppr" && $_POST['id']>=1)
{
$sql = "DELETE FROM pdv WHERE idpdv='".$_POST['id']."'";
mysql_query ($sql);
header('Location : http://localhost/admin/index.php');
}
include("haut.inc.php");
echo "<p align=left> :: fiche demande [".$_POST['id']."]</p>";
$sql = "SELECT * FROM pdv WHERE idpdv= '".$_POST['id']."'";
$resultat = mysql_query ($sql);
$pdv = mysql_fetch_array ($resultat);
?>
<form action="pdv_edit.php" method="post">
<input type="hidden" name="enregistre" value="oui" />
<input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" />
<table>
<tr>
<td>Date demande</td>
<td><input type="text" name="date_demande" value="<?php echo $pdv ['date_demande']; ?>" /></td>
</tr>
<tr>
<td>Nom</td>
<td><input type="text" name="nom" value="<?php echo $pdv ['nom']; ?>" /></td>
</tr>
<tr>
<td>Prénom</td>
<td><input type="text" name="prenom" value="<?php echo $pdv['prenom']; ?>" /></td>
</tr>
<tr>
<td>email</td>
<td><input type="text" name="email" value="<?php echo $pdv['email']; ?>" /></td>
</tr>
<tr>
<td>Ville</td>
<td><input type="text" name="ville" value="<?php echo $pdv['ville']; ?>" /></td>
</tr>
<tr>
<td>Code postal</td>
<td><input type="text" name="cp" value="<?php echo $pdv['cp']; ?>" /></td>
</tr>
<tr>
<td>Date mariage</td>
<td><input type="text" name="mariage" value="<?php echo $pdv['mariage']; ?>" /></td>
</tr>
<tr>
<td>Newsletter</td>
<td><input type="text" name="newsletter" value="<?php echo $pdv['newsletter']; ?>" /></td>
</tr>
<td>Message</td>
<td><input type="text" name="contenu" value="<?php echo $pdv['contenu']; ?>" /></td>
</tr>
</tr>
<td>Commande</td>
<td><input type="text" name="commande" value="<?php echo $pdv['commande']; ?>" /></td>
</tr>
</table>
<br/>
<select name="action">
<option value="maj">Enregistrer</option>
<option value="suppr">Supprimer</option>
</select>
<input type="submit" value="effectuer" />
</form>
<?php
mysql_close($liendb);
include ("bas.inc.php");
?> |