表单 在 else 语句中提交确认

Form Submit Confirmation in else statement

本文关键字:提交 确认 语句 else 表单      更新时间:2023-09-26

美好的一天。 我的问题是,JavaScript警报不适用于else语句。在我的 else 语句中,我想显示一个 javacript 警报,表明注册成功,但它没有出现。这是我的代码

<?php 
 if(isset($_POST['potpot'])){
$file=$_FILES['image']['tmp_name'];
$image= addslashes(file_get_contents($_FILES['image']['tmp_name']));
$image_name= addslashes($_FILES['image'] ['name']);
$image_size= getimagesize($_FILES['image'] ['tmp_name']);
if ($image_size==FALSE) { ?>
    <script type='text/javascript'>alert('Oppss! Thats not an image!')</script>
 <?php
  }else{ ?>
  <script type='text/javascript'>alert('Wait for admin confirmation! Check your email     within 24 hours')</script>
   <?php
    move_uploaded_file($_FILES["image"] ["tmp_name"], "images/" . $_FILES["image"]["name"]);
$fullname= $_POST['name'];
$course=$_POST['course'];
$yeargrad=$_POST['year'];
$img=$_FILES['image']["name"];
$email=$_POST['email'];
        mysql_query("INSERT INTO tblreg(fullname,course,
        year_grad,img,email,username,password,status)

        VALUES('$fullname',
             '$course', '$yeargrad','$img', '$email', 'no', 'no', 'not')");
         header('location:reg.php');
         } 
         }
         ?>

由于重定向而未出现警报(header('location:reg.php')