0

I have this following code->

html5 code block:

<div class="col-md-8 blogger-right-container">
                <form action="blogger_account.php" method="post" role="form" enctype="multipart/form-data">
                    <div class="form-group">
                        <h2>Blog Title</h2>
                        <input type="text" class="form-control" name="blog_title" placeholder="Enter title for your blog.">
                    </div>
                    <div class="form-group">
                        <h2>Blog Content</h2>
                        <textarea name="blog_content" class="form-control" cols="30" rows="10" placeholder="Enter the content here."></textarea>
                    </div>
                    <div class="form-group" style="text-align: center;">
                        <input type="submit" class="btn btn-success btn-lg" name="add" value="Insert">
                    </div>
                </form>

            </div> <!-- blogger right container -->

php code block: `

if(isset($_POST['add'])){

    $blogger = $_SESSION['blogger_email'];
    $blog_title = $_POST['blog_title'];
    $blog_content = $_POST['blog_content'];

    $insert_blog = "insert into blogs (blogger_email,blog_title,blog_content) values ('$blogger',$blog_title','$blog_content')";

    $run_blog = mysqli_query($con,$insert_blog);

    if($run_blog){
    echo "<script>alert('Blog inserted.')</script>";
    echo "<script>window.open('blogger_account.php','_self')</script>";
    }

}`

The php code block is not inserting the data in blogs table. The columns are in proper order, but still i tried to change the sequence and it didn't worked. Can anyone tell me whats wrong with my code.

anoop
  • 3,812
  • 2
  • 16
  • 28

1 Answers1

0

Please mention Error you are receiving.

In order to show detailed php errors, navigate to " How to get useful error messages in PHP? "

MySQL errors in php can be thrown this way --> PHP MySQL error handling

Community
  • 1
  • 1
khalidmehmoodawan
  • 598
  • 1
  • 5
  • 22
  • In order to show detailed php errors, navigate to " How to get useful error messages in PHP? " MySQL errors in php can be thrown this way --> PHP MySQL error handling – khalidmehmoodawan May 18 '17 at 17:56