下面是我的php文件,名为invalid_file_popup.php,我有为弹出窗口编写的所有代码,我已经用
进行了测试 <div class="buttons">
<a href="#" id="show" class="button left">Show it</a>
</div>
并且^^^工作正常。但是我希望将它包含在一个不同的页面中并将其称为“show”函数,如果它在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!
}
}