bstory
is a contenteditable div and typing inside - it sends the content to remote database
everything works except - if the content is - for example - session_start
- I'm getting error 403
in console
on php side I'm using PDO
inside this table I want to store code snippets from various programming languages, but obviously there is a flag - even if PDO is used
how to do this, pls
$('#bstory').on('input', function(){
let id = get_id();
let story = $(this).text().trim();
$.post('pro.php', {fn: 'bstory_input', args:[id, story]}, function(data){ // line 183
console.log(data); // error
});
});
php
function bstory_input($id, $story){
global $db;
$sq = "update nts set story = :astory where id = :aid";
$st = $db->prepare($sq);
$st->execute([
":astory" => $story,
":aid" => $id
]);
}
so typing letters - session_start
- no problem
but - session_start
- gives the error
console:
POST https://example.com/pro.php 403
expanding the error content in console:
send @ jquery.min.js:2
ajax @ jquery.min.js:2
w.<computed> @ jquery.min.js:2
(anonymous) @ index.js?1642744838:183
dispatch @ jquery.min.js:2
y.handle @ jquery.min.js:2