<html> <head> <title>TEST</title> <link rel="stylesheet" href="style.css" /> </head> <body> <div id="header"> <a href="index.php"> <h1>Welcome to the Admin Panel</h1></a> </div> <div id="sidebar"> <h2><a href="#">A</a></h2> <h2><a href="#">B</a></h2> <h2><a href="#">C</a></h2> <h2><a href="#">D</a></h2> </div> <?php include("includes/connect.php"); $edit_id = $_GET['edit']; $edit_query = "select * from posts where post_id='$edit_id'"; $post_id = $edit_row['post_id']; $post_title = $edit_row['post_title']; $post_author = $edit_row['post_author']; $post_keywords = $edit_row['post_keywords']; $post_image = $edit_row['post_image']; $post_content = $edit_row['post_content']; } } ?> <form method="post" action="edit_posts.php?edit_form=<?php echo $edit_id; ?>" enctype="multipart/form-data"> <table width="600" bgcolor="orange" align="center" border="10"> <tr> <td align="center" bgcolor="yellow" colspan="6"><h1>Edit The Post Here</h1></td> </tr> <tr> <td align="right">Post Title:</td> </tr> <tr> <td align="right">Post Author:</td> </tr> <tr> <td align="right">Post Keywords:</td> </tr> <tr> <td align="right">Post Image:</td> <td> <input type="file" name="image"> </tr> <tr> <td align="right">Post Content:</td> </tr> <tr> <td align="center" colspan="6"><input type="submit" name="update" value="Update Now"></td> </tr> </table> </form> </body> </html> <?php $update_id = $_GET['edit_form']; $post_title1 = $_POST['title']; $post_author1 = $_POST['author']; $post_keywords1 = $_POST['keywords']; $post_content1 = $_POST['content']; $post_image1= $_FILES['image']['name']; $image_tmp= $_FILES['image']['tmp_name']; if($post_title1=='' or $post_author1=='' or $post_keywords1=='' or $post_content1=='' or $post_image1==''){ } else { $update_query = "update posts set post_title='$post_title1',post_date='$post_date1',post_author='$post_author1',post_image='$post_image1',post_keywords='$post_keywords1',post_content='$post_content1' where post_id='$update_id'"; } } } ?>
Po naciśnięciu przycisku "Post has been updated" wyrzuca mi błąd:
"Any of the fields is empty"
a w polach:
Post Title <- <br /><b>Notice</b>: Undefined variable: post_title in <b>C:\xamp\htdocs\test\test\edit_posts.php</b> on line <b>59</b><br />
Post Author <- <br /><b>Notice</b>: Undefined variable: post_author in <b>C:\xamp\htdocs\test\test\edit_posts.php</b> on line <b>64</b><br />
Post Keywords <- <br /><b>Notice</b>: Undefined variable: post_keywords in <b>C:\xamp\htdocs\test\test\edit_posts.php</b> on line <b>69</b><br />
Post Image <- nie ładuje obrazka
Post Content: <- <br />
<b>Notice</b>: Undefined variable: post_content in <b>C:\xamp\htdocs\test\test\edit_posts.php</b> on line <b>81</b><br />
Gdzie może być błąd ?