Notice: Undefined index: action in C:\xampp\htdocs\Freia\admin-news.php on line 19
Tutaj linia 19:
a tutaj caly kod:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; protect_page(); admin_only($user_data); $title = $_POST['title']; $author = $_POST['author']; $content = $_POST['content']; mysql_query("INSERT INTO znote_news SET title='".$title."', author='".$author."', content='".$content."', date='".$date."'")or die(mysql_error()); $id = $_GET['id']; if($num_rows == 1){ $message = '<div id="success">The article is successfully deleted.</div>'; } $id = $_POST['id']; $title = $_POST['title']; $author = $_POST['author']; $content = $_POST['content']; mysql_query("UPDATE znote_news SET title='".$title."', content='".$content."', author='".$author."' where id='".$id."'") or die(mysql_error()); $message = '<div id="success">The article is successfully updated.</div>'; } } ?> <script type="text/javascript"> function remove(id) { var answer = confirm("You are about to permanently delete the selected item.\nClick Cancel 'to stop,' OK ' to delete.") if (answer){ } } </script> <link rel="stylesheet" type="text/css" href="news/news.css" /> <h1 style="padding-bottom: 0;">Admin News</h1> <?php } $query = "SELECT * FROM znote_news order by date DESC"; echo "<div style='margin-top: 15px;'>There are no articles yet. <a href='./admin-newnews.php'>Create a new article</a>.</div>"; }else{ ?> <table width='100%'> <tr><th style="width: 70%;">Title</th> <th>Author</th> <th></th> <th></th></tr> <?php ?> <tr> <td><a href="admin-editnews.php?id=<?php echo $row['id']; ?>"><img src="news/images/pencil.png" alt="Edit item" /></a></td> <td><img src="news/images/trash.png" onClick="remove('<? echo $row['id']; ?>')" style="cursor: pointer;" src="news/images/trash.png" alt="Delete item" /></td> </tr> <?php } } ?> </table> <?php include 'layout/overall/footer.php'; ?>
PROSZE O POMOC!!!