Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once("db.php");
- if(isset($POST['submit'])){
- $title = strip_tags($_POST['title']);
- $content = strip_tags($_POST['content']);
- $title2 = mysqli_real_escape_string($db, $title);
- $content2 = mysqli_real_escape_string($db, $content);
- $date = date('l jS \of F Y h:i:s A');
- $sql = "INSERT INTO blog_posts(title, content, date) VALUES ('$title2', '$content2', '$date')";
- if($title == "" || $content == ""){
- echo "Wypełnij pola!";
- }
- mysqli_query($db, $sql);
- header("Location: index.php");
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>post</title>
- </head>
- <body>
- <form action="post.php" method="post">
- <input placeholder="Tytuł" name="title" type="text" autofocus size="48"><br /><br />
- <textarea placeholder="Treść" name="content" rows="20" cols="50"></textarea><br />
- <input name="submit" type="submit" value="Dodaj posta">
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment