Php确认框
我有一个文本框,如果用户输入一个值,它将转到db并检查该值= y如果是这样它已向用户发出警告,如果你想要激活,如果确定它应该rediredc到其他页面,如果没有也重定向到一些页面。
警报框应该是或否
我不知道我的sql脚本是错还是java脚本
$activate = mysql_query("SELECT * FROM `thirdpartycategorymaster` WHERE `delete` = 'y' ");
$activate='y';
if($activate)
{
header("location:catact.php");
}
else
{
$activate='NULL';
header("location:tp_home.php");
}
$checkformembers = mysql_query("SELECT * FROM thirdpartycategorymaster WHERE ThirdPartyCategoryName = '$ThirdPartyCategoryName'");
$no=0;
if ($ThirdPartyCategoryName)
{
if(mysql_num_rows($checkformembers) != 0)
{
header('location:newcat.php?msg=category exists');
}
else
{
$sql="INSERT INTO thirdpartycategorymaster (ThirdPartyCategoryID, ThirdPartyCategoryName)
VALUES
('$_POST[ThirdPartyCategoryID]',
'$_POST[ThirdPartyCategoryName]'
)";
$no=1;
header('location:tp_home.php?add=Category Added Successfully');
}
if (!mysql_query($sql,$conn))
{
die('Error: ' . mysql_error());
}
}
else
header('location:tp_home.php');
/*if ($no==1)
header("Location:tp_home.php?msg=Category Added Successfully");
else
header("Location:tp_home.php");
*/
mysql_close($conn);
没有找到相关结果
已邀请:
1 个回复
净爽
工作示例:http://www.jsfiddle.net/BBuwL/ 但请考虑如果用户禁用了javascript,或者google出现并抓住链接,会发生什么。 更好的方法是发布表格进行确认。所以在php中你可以重定向到一个确认页面,其中包含一个包含yes和no按钮的表单。