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
|
<html>
<head><title>Ajouter des promotions</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="layout.css" rel="stylesheet" type="text/css" /></head>
<?
error_reporting(0);
include "inc/config.php";
include "inc/pagination.php";
?>
<body >
<form name="f1" method="POST" action="#">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<table><tr><td>Titre:<td><input type="text" maxlength="26" name="titre" >
<center><tr><td>Du<td> <input value="2000-01-01" maxlength="255" name="debut"></td></tr>
<tr><td>au:<td> <input value="2000-01-01" maxlength="255" name="fin" ></td>
<tr><th rowspan="2">Détail: </th><td> <TEXTAREA NAME="dtl" COLS=40 ROWS=6>Entrer le détail de votre promotion...</TEXTAREA>
</td></tr>
</table>
<input type="submit" name="send" value="ajouter">
<?
if ($_POST['send']=="ajouter"){
$title=$_POST['titre'];
$dtl=$_POST['dtl'];
$dbu=$_POST['debut'];
$f=$_POST['fin'];
echo "enregistrement effectuer";
mysql_select_db("0963",$conn);
mysql_query("insert into promo values ('','$title','$dtl','$dbu','$f')");
}
if ($_GET['act']=="mod"){
$i=$_GET['id'];
$title=$_POST['titre'];
$dtl=$_POST['dtl'];
$dbu=$_POST['debut'];
$f=$_POST['fin'];
mysql_query("update promo set Titre='$title',Detail='$dtl',Date_debut='$dbu',Date_fin='$f' where Id_promo='$i'");
echo "Modifier" . $i . $title;
}
if ($_GET['act']=="supr"){
$i=$_GET['id'];
mysql_query("delete from promo where Id_promo='$i'");
echo "Promotion supprimer avec succés";
}
?>
<?
$sql = "SELECT * FROM promo";
$url = $_SERVER['PHP_SELF']."?p=";
$total = mysql_query($sql);
$nblignes = mysql_num_rows($total);
$nbpages = ceil($nblignes/$parpage);
$result = reqlimit($nblignes,$parpage,$sql);
?><table width="652" border="0" align="center">
<tr>
<td width="38" bgcolor="#CAFFFF">id</td>
<td width="61" bgcolor="#CAFFFF">Titre</td>
<td width="95" bgcolor="#CAFFFF">Date début</td>
<td width="146" bgcolor="#CAFFFF">Date fin</td>
<td width="146" bgcolor="#CAFFFF">Détails</td>
<td width="140" bgcolor="#CAFFFF">Action</td>
</tr>
<? while ($news = mysql_fetch_array($result)) {?>
<tr>
<td bgcolor="#CCCCCC"><? echo $news['Id_promo']; ?></td>
<td bgcolor="#CCCCCC"><? echo $news['Titre']; ?></td>
<td bgcolor="#CCCCCC"><? echo $news['Date_debut']; ?></td>
<td bgcolor="#CCCCCC"><? echo $news['Date_fin']; ?></td>
<td bgcolor="#CCCCCC"><? echo $news['Detail']; ?></td>
<td bgcolor="#CCCCCC"><a href="?act=supr&id=<?=$news['Id_promo']?>&p=<?=$_GET['p']?>">Supprimer</a>-<a href="?act=mod&id=<?=$news['Id_promo']?>&p=<?=$_GET['p']?>">Modifier</a></td>
</tr><? }?>
</table>
<?
echo "<center>";
echo pagination($url,$parpage,$nblignes,$nbpages);
echo "</center>";
mysql_free_result($result);
?>
</form>
</body>
</html> |
Partager