So time for another problem.
I cant get my editPages to work, im not getting any errors but the posts/pages arent getting updated.
I will post everything here, and maby someone can check what i have missed or done wrong.
The editPage.php file:
Code HTML4Strict:<?php $query = mysql_query("SELECT * FROM textareas WHERE ID =" . (int) $_GET['id']); $post = mysql_fetch_assoc($query); ?> <!DOCTYPE html> <head> <title>QSS - admin area</title> <link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="admin.css" type="text/css" media="all"> </head> <body> <div class="wrapper"> <span>Logged in! Welcome <?php echo $_SESSION['user']; ?></span> <a href="logout.php">Logout</a> <ul class="topnav"> <li><a href="index.php">Home</a></li><li><a href="posts.php">Manage Posts</a></li><li><a href="cats.php">Manage Categories</a></li><li><a href="pages.php">Manage Pages</a></li> </ul> <div class="content"> <form action="doEditPages.php" method="post"> <input type="hidden" name="id" value="<?php echo $_GET['id']; ?>" /> <label for="TextHeading">Header</label><br> <input type="text" name="TextHeading" value="<?php echo $post['Heading']; ?>" /><br> <label for="TextContent">Content</label><br> <textarea name="TextContent"><?php echo $post['Content']; ?></textarea><br> <input type="submit" value="Update" name="submit" /> </form> </div> </div> </body> </html>
The editPages function:
Code PHP:function editPages($tHeading, $tContent, $id) { $id = mysql_real_escape_string($id); $query = "UPDATE textareas SET Heading = '$tHeading', Content = '$tContent', WHERE ID = '$id'"; mysql_query($query); }
And the doEditPages.php file:
Code PHP:<?php include('includes.php'); if(isset($_POST['submit'])) { if(isset($_POST['TextHeading'])) { if(isset($_POST['TextContent'])) { editPages($_POST['TextHeading'],$_POST['TextContent'],$_POST['id']); header("Location: pages.php"); } else { echo "Please enter some content!"; } } else { echo "Please set a header name" ; include('editPages.php'); } } else { header("Location: editPages.php"); }



Reply With Quote
Bookmarks