我无法使用ajax serialize()在数据库中插入textarea值。
<form id="addform" class="form-horizontal" enctype="multipart/form-data" >
<div class="form-group">
<label for="link" class="control-label col-xs-3">Journal Name</label>
<div class="col-xs-6">
<input type="text" name="name" class="form-control" placeholder="Journal Name">
</div>
</div>
<div class="form-group">
<label for="link" class="control-label col-xs-3">Description</label>
<div class="col-xs-9">
<textarea name="description" id="editor1" rows="10" cols="80" value=""></textarea>
</div>
</div>
<div class="form-group">
<label for="link" class="control-label col-xs-3">Image</label>
<div class="col-xs-6">
<input type="file" name="file" class="form-control" >
</div>
</div>
</form>
$('#save11').click(function(){
$.ajax({
type: "POST",
url: "page/add-journal.php",
data: $('#addform').serialize(),
success: function(data) {
window.location.href="home-page.php";
}
});
});
<?php
include '../dbConnection.php';
echo $sql="insert into journal set name='".$_POST['name']."', description='".mysql_real_escape_string($_POST['description'])."', price1='".$_POST['price1']."', price2='".$_POST['price2']."', price3='".$_POST['price3']."', file='".$file."', active='".$_POST['active']."'";
$query = mysql_query($sql);
?>