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.

3
  • @session_start is missing? Commented May 18, 2017 at 10:06
  • session_start is given in the starting of html document. Still it isn't working Commented May 18, 2017 at 10:08
  • -there is some errors in your code.please check my answer Commented May 18, 2017 at 10:11

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.