用php+dw做一个注册页面,点击注册却不能跳转,但注册信息已经在数据库已经有了,求大神解答 20

//***Redirectifusernameexists$MM_flag="MM_insert";if(isset($_POST[$MM_flag])){$MM_dup... // *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect="regfail.php";
$loginUsername = $_POST['username'];
$LoginRS__query = sprintf("SELECT username FROM member WHERE username=%s", GetSQLValueString($loginUsername, "text"));
mysql_select_db($database_memberconn, $memberconn);
$LoginRS=mysql_query($LoginRS__query, $memberconn) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);

//if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO member (username, password, question, answer, truename, sex, address, tel, QQ, email, authority) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['question'], "text"),
GetSQLValueString($_POST['answer'], "text"),
GetSQLValueString($_POST['truename'], "text"),
GetSQLValueString($_POST['sex'], "text"),
GetSQLValueString($_POST['address'], "text"),
GetSQLValueString($_POST['tel'], "text"),
GetSQLValueString($_POST['QQ'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['authority'], "text"));

mysql_select_db($database_memberconn, $memberconn);
$Result1 = mysql_query($insertSQL, $memberconn) or die(mysql_error());

$insertGoTo = "regok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>

}
这是代码,点击注册网页提示问题出在这一句header(sprintf("Location: %s", $insertGoTo));
展开
 我来答
有范er的小青年
2015-10-02 · TA获得超过866个赞
知道小有建树答主
回答量:806
采纳率:20%
帮助的人:247万
展开全部
header("location:regok.php")

不可以吗?

sprintf不是格式化输出吗?为毛加这个?

推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式