Hi
I am creating my two pages for removing records (articles) from my blog databases. These pages are delete.php and confirm_delete.php
I can't really find why the code is getting rid of them from the database.
Here is my php code in the confirm delete page...
<?php
include_once("include/connect_sql.inc.php");
$thisArticle_id = $_POST['article_id'];
$sql = "SELECT * FROM blogprofessional
WHERE article_id = '".$thisArticle_id."'";
$result = mysql_query($sql);
$numberOfRows = mysql_num_rows($result);
if ($numberOfRows==0) {
echo 'Sorry. No records found !!';
}
else if ($numberOfRows>0) {
$i=0;
$article_id = mysql_result($result,$i,"article_id");
$issue_no = mysql_result($result,$i,"issue_no");
$issue_date = mysql_result($result,$i,"issue_date");
$focus = mysql_result($result,$i,"focus");
$toc = mysql_result($result,$i,"toc");
$article = mysql_result($result,$i,"article");
}
?>
and the confirm delete button/form is as follows:
<tr><form name="customersEnterForm" method="POST" action="pro_blog_delete.php">
<td width="609"><input type="hidden" name="thisArticle_idField" value="<? echo $thisArticle_id; ?>" /></td>
<td width="215"><input type="submit" name="submitConfirmDeleteCustomersForm" value="Delete from Blog Archive" /></td>
<td width="85"><input type="button" name="cancel" value="Back" onclick="javascript:history.back();" /></td></form>
</tr>
now finally when the button is clicked and redirection to the delete page occurs this is the code that should process:
<?php
include_once("include/connect_sql.inc.php");
// Retreiving Form Elements from Form
$thisArticle_id = addslashes($_POST['thisArticle_idField']);
$sql = "DELETE FROM blogprofessional
WHERE article_id = '$thisArticle_id'";
$result = mysql_query($sql);
?>
When I check in phpmyadmin the record has not been deleted.
Please help, thank you very much.