gpt4 book ai didi

php - 使用ajax提交表单后获取表单值(mysql_insert_id)

转载 作者:行者123 更新时间:2023-11-30 23:23:25 25 4
gpt4 key购买 nike

在我的表单通过 ajax 和表单验证 (jquery.validationEngine) 提交后,我试图获取一个值 (mysql_insert_id) 但没有成功..

$(document).ready(function()
{
$("#form1").validationEngine('attach',
{
autoHidePrompt:true,showOneMessage:true,
onValidationComplete: function(form, status)
{
if(status === true)
{

formget(document.getElementById('form1'),'page.php');

TINY.box.show({html:'The entry (i want the id here..) has been updated successfully!',animate:false,close:false,mask:false,boxid:'success',autohide:2,top:5});
}
else
{
TINY.box.show({html:'Please check the form and try again',animate:false,close:false,mask:false,boxid:'error',autohide:2,top:5});
}
}
});

我的page.php文件

$query="INSERT INTO users (userid,title,)VALUES ('".$_SESSION['id']."', '".$_REQUEST['title']."')"; $result=mysql_query($query);
$id = mysql_insert_id();

最佳答案

$query="INSERT INTO users (userid,title,)VALUES ('".$_SESSION['id']."', '".$_REQUEST['title']."')"; $result=mysql_query($query);
$id = mysql_insert_id();
echo mysql_error();

查看错误信息;

关于php - 使用ajax提交表单后获取表单值(mysql_insert_id),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14498453/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com