if (isset($_GET['success']) && empty ($_GET['success'])) {
echo 'Thank you for registering your service with us!';
} else {
//if no errors register user
if (empty($_POST) === false && empty($errors) === true) {
$daysavailable='';
foreach ($_POST['DaysAvailable'] as $value)
{
$daysavailable .=$value." ";
}
//$test = "Monday, Tuesday";
$register_info= array (
'MemberID' => $_POST['MemberID'],
'OddJobName' => $_POST['OddJobName'],
'Description' => $_POST['Description'],
'DaysAvailable' => $daysavailable,
);
register_job($register_info);
if(success){
echo"<script type=\"text/javascript\">".
"alert('success');".
"</script>";
exit ();
} else if (empty($errors) === false){
//otherwise output errors
echo output_errors($errors);
}
}
查看以前的帖子,我更改了代码以添加:
if(success){ //ADDED CODE
echo"<script type=\"text/javascript\">".
"alert('success');".
"</script>";
完整代码:
if (isset($_GET['success']) && empty ($_GET['success'])) {
echo 'Thank you for registering your service with us!';
} else {
//if no errors register user
if (empty($_POST) === false && empty($errors) === true) {
$daysavailable='';
foreach ($_POST['DaysAvailable'] as $value)
{
$daysavailable .=$value." ";
}
$register_info= array (
'MemberID' => $_POST['MemberID'],
'OddJobName' => $_POST['OddJobName'],
'Description' => $_POST['Description'],
'DaysAvailable' => $daysavailable,
);
register_job($register_info);
if(success){ //ADDED CODE
echo"<script type=\"text/javascript\">".
"alert('success');".
"</script>";
exit ();
} else if (empty($errors) === false){
//otherwise output errors
echo output_errors($errors);
}
}
现在我弹出一个窗口,但在同一页面上,“成功”是未定义的同意。
我想要发生的是,当用户成功注册时,他们将被重定向到 index.php,并且当此页面打开时,我需要一个弹出窗口来显示告诉用户他们已成功注册。
我对 PHP 不是很好(从上面可能很清楚)所以任何帮助将不胜感激!