In the modify portion of this script below I'm attempting to retreive information from a database and preserve, update the field values upon the submit of the action.
The fields seem to be keeping preserved information, but when I alter any of the preserved text in the fields and submit it brings back the previous information in the fields and doesn't seem to update any of the fields upon action? Any help would be appreciated. Thanks
// MODIFY NEWS
if($action == "modify"){
$query = mysql_query("Select * from $table where article=$PID order by date");
while(list($article,$title,$date,$poster,$email,$news,$newsfull) = mysql_fetch_row($query)){
?>
<form method="POST" action="<? echo"$PHP_SELF?action=modify&PID=$PID";?>">
<input type="hidden" name="modthis" value="1">
<div align="center">
<center>
<table border="0" cellspacing="1" cellpadding="3" class="table_border">
<tr>
<td colspan="2" class="header_cell"> <p align="center">News
admin panel</p></td>
</tr>
<tr>
<td align="right" class="cells">Poster:</td>
<td class="cells"><input class="box" type="text" name="poster1" size="30" value="<?=$poster;?>"></td>
</tr>
<tr>
<td align="right" class="cells">E-mail:</td>
<td class="cells"><input class="box" type="text" name="email1" size="30" value="<?=$email;?>"></td>
</tr>
<tr>
<td align="right" class="cells">Title:</td>
<td class="cells"><input class="box" type="text" name="title1" size="30" value="<?=$title;?>"></td>
</tr>
<tr>
<td align="right" valign="top" class="cells">News:</td>
<td class="cells"><textarea class="input" rows="10" name="news1" cols="61"><?=$news;?></textarea></td>
</tr>
<tr>
<td align="right" valign="top" class="cells">Full Article</td>
<td class="cells"><textarea class="input" name="newsfull1" cols="61" rows="10"><?=$newsfull;?></textarea></td>
</tr>
<tr>
<td align="right" valign="top" class="cells"> </td>
<td class="cells"><input type="submit" name="submit"></td>
</tr>
<tr>
<td colspan="2" class="header_cell"> <p align="center">
</td>
</tr>
</table>
</center>
</div>
</form>
<?
}
}
if($modthis == "1"){
$news1 = nl2br($news1);
$newsfull1 = nl2br($newsfull1);
$thedate = date("Y-m-d-H-i-s");
$query = "update $table set title='$title1', date='$thedate', poster='$poster1', email='$email1', news='$news1', newsfull='$newsfull1' where ID=$PID";
mysql_query($query,$db);
echo"<center>Post with article $PID has been modified!$b</center>";
}
else echo "" . $denied . "" . $nomsg . "" . $b . "";
// END MODIFY NEWS