[英]Unable to insert data in a table using php
我有以下代碼->
html5代碼塊:
<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代碼塊:
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>";
}
}`
php代碼塊未在Blogs表中插入數據。 列的順序正確,但是我仍然嘗試更改順序,但沒有用。 誰能告訴我我的代碼有什么問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.