Haii,
我想在用户提交表单后显示一些说“感谢提交”的消息或提醒。怎么做?将msg / alert代码放在我的代码上的完美位置在哪里?这里我将数据插入到mysql代码中。
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form")) {
$updateSQL = sprintf("UPDATE `admin` SET user_name=%s, password=%s WHERE id=%s",
GetSQLValueString($_POST['user_name'], "text"),
GetSQLValueString($_POST['pass1'], "text"),
GetSQLValueString($_POST['id'], "double"));
mysql_select_db($database_pspm, $pspm);
$Result1 = mysql_query($updateSQL, $pspm) or die(mysql_error());
$updateGoTo = "adminupdate.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
我之前尝试过此代码,但无法正常工作。
echo '<script language="javascript">';
echo 'alert("message successfully sent")';
echo '</script>';
答案 0 :(得分:1)
删除此行标题(...),将其替换为代码:
echo '<script language="javascript">';
echo 'alert("message successfully sent");';
echo 'window.location="'.$updateGoTo.'";';
echo '</script>';
答案 1 :(得分:0)
请在此代码之前输入javascript代码: -
echo '<script>alert("Thanku for submit");window.location="your path where you want to redirect";</script>';
或另一种方法
#pragma location=ADDR_VECTOR_TABLE
static __no_init isr_ptr_t vector_table[INTERRUPT_SOURCE_TOTAL];