j'ai ma forme des mots censurés ainsi:
<form action="index.php?menu=VerifyGBookCensure" method="post" name="form">
<table width="100%" class="DivStyle2">
<tr>
<td width="40%" align="right">Word:</td>
<td width="60%"><input type="text" name="word" maxlength="30" size="20" value="" class="input01"></td>
</tr>
<tr>
<td width="40%" align="right">Replace with:</td>
<td width="60%"> <input type="text" name="replacement" maxlength="30" size="20" value="***" class="input01"></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Send" class="input02">
</td>
</tr>
</table>
</form>
<br>
<?php
$connection = mysql_connect($host, $user, $pass) or die(mysql_error());
$db = mysql_select_db($db_name, $connection) or die(mysql_error());
$sql = "select * from $table_gbook_censure order by id DESC";
$result = mysql_query($sql,$connection) or die(mysql_error());
?>
<table width="100%" class="DivStyle2" border="1" style="border-collapse:collapse">
<tr>
<td width="20%" align="left">Date</td>
<td width="20%" align="left">Word</td>
<td width="20%" align="left">Replacement</td>
<td width="40%" align="center">Actions</td>
</tr>
<?php
while($censure = mysql_fetch_array($result)) {
$date = $censure['date'];
$hour = $censure['hour'];
$word = $censure['word'];
$replacement = $censure['replacement'];
?>
<tr>
<td width="20%" align="left"><?php echo "$date"; ?> <?php echo "$hour"; ?></td>
<td width="20%" align="left"><?php echo "$word"; ?></td>
<td width="20%" align="left"><?php echo "$replacement"; ?></td>
<td width="40%" align="right">
Update
<?php
echo "<a href=\"index.php?menu=GuestBookCensure&action=del&id=$censure[id]\">Delete</a>";
?>
</td>
</tr>
<?php
}
?>
</table>
et la page de verification est comme suite:
<?php
if(isset($_GET['action'])) $mcenu = $_GET['action'];
else $action = '';
$word = $_POST['word']; // post city as var
$replacement = $_POST['replacement']; // post city as var
$date=date("d/m/Y");
$hour=date("H:i");
$connection = mysql_connect($host, $user, $pass) or die(mysql_error());
$db = mysql_select_db($db_name, $connection) or die(mysql_error());
//if ($action == 'add')
//{
//$sql = "INSERT INTO $table_gbook_censure VALUES ('','$word','$replacement','$date','$hour')";
//$result = mysql_query($sql,$connection) or die(mysql_error());
//echo 'insert done';
//}
if ($action == 'del')
{
$sql2 = mysql_query("DELETE FROM censure WHERE id='$_GET[id]'");
$result2 = mysql_query($sql2,$connection) or die(mysql_error());
echo 'delete done';
}
?>
mais quand je click sur Delete, lot censuré ne se supprime pasmerci pour votre aide