PHP Delete ...

Ask about a PHP problem here.
Locked
User avatar
louiegiezer
Posts: 57
Joined: Fri Oct 21, 2011 11:31 am
Contact:

PHP Delete ...

Post by louiegiezer »

i'll looking 4 delete function and i found this one... this code not work 4 me...

[syntax=php]
<?php
include 'core/init.php';
include 'includes/overall/header.php';


if (isset($_POST['action']) && $_POST['action'] === 'delete'){
$errors = array();

if (empty($errors)){
delete_post($_GET['post_id']);
}
}

$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
?>

<div class="table">
<div class="tr-style">
<div class="style1">
Title
</div>
<div class="style2">
Content
</div>
<div class="style3">
Categories
</div>
<div class="style3">
User
</div>
<div class="style4">
Date Published
</div>
<div class="style4">
Action
</div>
</div>

<?php
foreach (get_all_post($page, 5) as $post)
{
?>

<div class="clear"></div>
<form action="" method="post">
<div class="tr-style2">
<div class="style1a">
<?php echo $post['title']; ?>
</div>
<div class="style2a">
<?php echo $post['body']; ?>
</div>
<div class="style3a">
<?php echo $post['cat']; ?>
</div>
<div class="style3a">
<?php echo $post['user']; ?>
</div>
<div class="style4a">
<?php echo $post['date']; ?>
</div>
<div class="style4a">
<a href="edit.php">Edit</a>
</div>
<div class="style4a">
<a href="?action=delete" title="delete post">Delete</a>
</div>
</div>
</form>
<?php } ?>

?>
[/syntax]
User avatar
killfrog47
Posts: 106
Joined: Tue Mar 12, 2013 2:52 am
Location: Tempe, AZ
Contact:

Re: PHP Delete ...

Post by killfrog47 »

Is it giving you any errors? If so what errors?
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: PHP Delete ...

Post by Temor »

I believe this is the same topic discussed in another forum. if so, let me know so I can delete it, or if not, then I'll unlock it. But I'll lock it for now to avoid confusion.
Locked