Eléphanteau du PHP |
45 Messages
12 sept. 2005, 14:28
form.php
<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($row = mysql_fetch_array($result)) {
$date = $row['date'];
$hour = $row['hour'];
$word = $row['word'];
$replacement = $row['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 Delete</td>
</tr>
<?php
}
?>
</table>
view.php:
if(isset($_POST['word'])) $word = $_POST['word'];
else $word = '';
if(isset($_POST['replacement'])) $replacement = $_POST['replacement'];
else $replacement = '';
.
.
.
$message = str_replace($word,$replacement,$message);
?>