Page 1 of 1

PHP Delete ...

Posted: Wed Oct 23, 2013 7:08 am
by louiegiezer
i'll looking 4 delete function and i found this one... this code not work 4 me...
<?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 } ?>

?>

Re: PHP Delete ...

Posted: Wed Oct 23, 2013 6:39 pm
by killfrog47
Is it giving you any errors? If so what errors?

Re: PHP Delete ...

Posted: Wed Oct 23, 2013 7:21 pm
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.