Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h1>Edit post!</h1>
- <form name="feditpost" method="post" action="">
- <?php
- foreach($db->query("SELECT * FROM blog WHERE ID LIKE '$ID'") as $row)
- {
- echo "Titel: <input type='text' size='50' name='titel' value='$row[titel]'><br>";
- echo "Post:<br>";
- echo "<textarea name='editblog'>";
- echo $row[post];
- echo "</textarea>";
- echo "<input type='hidden' name='ID' value='";
- echo $row[ID];
- echo "'>";
- }
- ?>
- <input type="submit" value="Edit post" name="postedit">
- </form>
- <script>
- CKEDITOR.replace( 'editblog' );
- </script>
- <?php
- if(isset($_POST['postedit']))
- {
- $titel = $_POST['titel'];
- $post = $_POST['editblog'];
- $ID = $_POST['ID'];
- $STH = $db->prepare("UPDATE blog SET titel='$titel',post='$post' WHERE ID=$ID");
- $STH->execute();
- echo "<h2>Post edited!</h2>";
- }
Advertisement
Add Comment
Please, Sign In to add comment