【发布时间】:2019-02-24 22:43:21
【问题描述】:
她是我的密码 HTML
<form id="msg_form">
<input type="text" name="msg_text">
<button type="submit" name="send">Send</button>
</form>
AJAX
$(function () {
$('#msg_form').on('send', function (e) {
e.preventDefault();
$.ajax({
type: 'POST',
url: 'msg.php',
data: $('#msg_form').serialize(),
success: function () {
}
});
});
});
现在我想在请求页面上获取数据 如何发送表单数据并在 anthor 页面上接收它 PHP 代码
$msg_text=$_POST['msg_text'];
$receiver_id=$_POST['sender_id'];
$sender_id=$_SESSION['u_id'];
$sql="INSERT INTO massges (msg_text,sender_id,receiver_id) values('$msg_text', '$sender_id', $receiver_id)";
$run=mysqli_query($con,$sql);
【问题讨论】:
-
您使用什么语言接收数据?
-
我想用 PHP 来接收数据
-
好的,所以为了让一些 PHP 开发人员参与进来,你应该用 PHP 标记这个问题,然后声明你希望能够用 PHP 检索表单数据。此外,请展示您迄今为止提出的任何 PHP 代码。
-
@lipumuna 看到你的评论,我马上有东西给你。你有任何可以发布的php代码吗?
-
是的,我已经发布了,现在看到