0

下面是我的名为 invalid_file_popup.php 的 php 文件,我已经为弹出窗口编写了所有代码,并且我已经对其进行了测试

    <div class="buttons">
    <a href="#" id="show" class="button left">Show it</a>
    </div>

^^^ 工作正常。但我想将它包含到另一个页面中,如果它在这个 if-else 语句中,则调用这个“显示”函数。有人知道如何调用它吗?

invalid_file_popup.php

<!doctype html>
<html>
<head>

<link href='http://fonts.googleapis.com/css?family=Headland+One|Open+Sans:400,300&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://labs.voronianski.com/media/style/reset.css">
<link rel="stylesheet" href="./css/invalid.css">
<link rel="stylesheet" href="./css/av_invalid.css">
</head>
<body>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">   
</script>
<script src="./js/jquery.avgrund.js"></script>
<script>
$(function() {
    $('#show').avgrund({
        height: 150,
        holderClass: 'custom',
        showClose: true,
        showCloseText: 'close',
        onBlurContainer: '.container',
        template: "<p>Error. Either all the correct required (*) fields were't entered or image file was invalid.</br></br>" +
        "File must be jpeg, jpg, pjpeg, x-png or png.</p>"          
    });
});
</script>
</body>
</html>

在这段代码的底部是我想调用javascript函数的地方,所以它会弹出窗口。我在其中包含了 invalid_file_popup.php

if(isset($_POST['submit'])){
if ((($image_type == "image/gif")
|| ($image_type == "image/jpeg")
|| ($image_type == "image/jpg")
|| ($image_type == "image/pjpeg")
|| ($image_type == "image/x-png")
|| ($image_type == "image/png"))
&& ($image_size < 205000)
&& in_array($extension, $allowedExts))
  {
  if ($_FILES["file"]["error"] > 0)
   {
   echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
  }
  else
   {
   echo "Upload: " . $image_name . "<br>";
   echo "Type: " . $image_type . "<br>";
   echo "Size: " . ($image_size / 1024) . " kB<br>";
   echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
   // redirect somewhere

   if (file_exists("upload/" . $image_name))
     {
     // redirect somewhere and let user know it already exists
    echo $image_name . " already exists. ";
    }
   else
    {

    mysql_query("INSERT INTO Events (event_name, event_venue, event_info, event_price,     
    event_day, event_month, event_year, event_online, event_contact, image_name, image, 
    user_id) VALUES ('$event_name', '$event_venue', '$event_info', '$event_price', 
    '$event_day', '$event_month', '$event_year', '$event_online', '$event_contact', 
    '$image_name', '$image',".$_SESSION['id'].")");

  move_uploaded_file($_FILES["file"]["tmp_name"],
  "upload/" . $image_name);
  echo "Stored in: " . "upload/" . $image_name;
  echo "SUCCESSFULLY ADDED EVENT";

  $path = "/upload/$image_name";
  echo "<img src='".$path."' />";


 }
 }
  }
 else
{
 include "invalid_file_popup.php";
 // HAVE INCLUDED THE FILE NOW I WANT TO MAKE THE CALL!
}
}
4

0 回答 0