I have make a form with this code:
<form action="action.php" method="POST">
HTML:
<textarea name="html"></textarea>
<input type="submit">
</form>
and Insert it with php :
<?php
include "database.php";
$html = mysqli_real_escape_string($connect, $_POST['html']);
$insert = mysqli_query($connect, "INSERT INTO data VALUES('$html')");
?>
I have used that, and it successfully inserted to mysql, but some of my html string is missing Example: if i insert 2000 character of html, it just insert 250 character Note: I'm using jquery to post the form
$.ajax({
url : url_login,
data : 'html='+html,
type : 'POST',
dataType: 'html',
success : function(mess){
$('#content').html(mess);
},
});
Please help
$_POST.mysqliyou should be using parameterized queries andbind_paramto add user data to your query. DO NOT use manual escaping and string interpolation or concatenation to accomplish this because you will create severe SQL injection bugs. Accidentally unescaped data is a serious risk. Using bound parameters is less verbose and easier to review to check you’re doing it properly.