Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title></title>
- </head>
- <body>
- <form action="share.php" method="post">
- <input type="text" name="posttitle"></input>
- <br/>
- <textarea name="postcontent"></textarea>
- <br/>
- <input type="submit" value="insert"></input>
- </form>
- </body>
- </html>
- <?php
- $con = mysqli_connect("localhost", "root", "", "mugg_website");
- if(!$con){
- echo 'database not connected';
- }
- $articleName = mysqli_real_escape_string($con, $_POST['posttitle']);
- $articleContent = mysqli_real_escape_string($con, $_POST['postcontent']);
- $sql = "INSERT INTO post (post_title, post_content) VALUES ('$articleName', '$articleContent')";
- if(!mysqli_query($con,$sql)){
- echo 'notpublished';
- }else{
- echo 'published';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement