私はこの値を渡そうとしていました:
// Content to submit to php
Others string here. And this link:
http://www.youtube.com/watch?v=CUUgKj2i1Xc&feature=rec-LGOUT-exp_fresh+div-1r-2-HM
phpページに移動し、データベースに挿入します。これが私の現在のコードです:
... // javascript
var content = $("#mcontent").val();
$.ajax({
url : '<?php echo PATH; ?>functions/save.php',
type: 'POST',
data: 'id=<?php echo $_GET['id']; ?>&content=' + content + '&action=save&val=<?php echo md5("secr3t" . $_SESSION['userid_id']); ?>',
dataType: 'json',
success: function(response) {
if (response.status == 'success') {
alert(response.message);
} else {
alert(response.message);
}
}
});
実際にはエラーはありませんが、データベースで保存されたのは次のとおりです。
Others string here. And this link:
http://www.youtube.com/watch?v=CUUgKj2i1Xc
私は何が問題なのか知っていると思います、問題は:
http://www.youtube.com/watch?v=CUUgKj2i1Xc&feature = rec- LGOUT -exp_fresh + div-1r-2-HM
別のPOSTデータとして「&feature=」が必要だと思います。私が試したこと:
アンパサンドの前にスラッシュを追加する(http://phpjs.org/functions/addslashes:303)
Javascript HTMLエンコード/デコード関数の使用(インターネットのどこかにあります)
しかし、両方とも機能しません。他に方法はありますか?
編集:
発生する可能性のある他の問題を予測していますか?コンテンツはユーザーによるタイプ/書き込みです。つまり、ユーザーは何でも入力/書き込みできます。バックハンドでは、「mysql_real_escape_string」を含む他のチェックを行いました