嘿伙计们,我很难弄清楚这一点。
我想我了解灯箱及其工作原理。我在播放服务器上使用过,效果很好;直到我在 php 的 if else 语句中使用它来测试表单验证。如果用户填写的表单不正确,那么这个失败图像的灯箱应该会弹出,但它不会。我确实希望在这美妙的景象中有人可以帮助我
<html>
<?php
<head>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/j``avascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link rel="stylesheet" type="text/css" href="css.css" />
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
</head>
$EmailAddres = $_POST[Email];
$FirstName = $_POST[FName];
$LastName = $_POST[LName];
$PhoneNumber = $_POST[Phone];
$AltPhoneNumber = $_POST[AltPhone];
//This is the testing and the validation testing
$flag="OK";
$msg="";
$todo="test";
if(!ereg("^[-A-Za-z]*$",$FirstName)){
echo "Invalid first Name";
$flag="NOTOK";
}
if(!ereg("^[-A-Za-z]*$",$LastName)){
echo "Invalid Last Name";
$flag="NOTOK";
}
if(!ereg("^[-A-Za-z0-9_]+[-A-Za-z0-9_.]*[@]{1}[-A-Za-z0-9_]+[-A-Za-z0-9_.]*[.]{1}[A-Za- z]{2,5}$",$_POST[Email])){
echo "Invalid Email Address";
$flag="NOTOK";
}
/*This is to validate the phone number input */
if(!ereg("[0-9]{10,11}", $PhoneNumber)){
echo "Invalid phone number";
$flag="NOTOK";
}
if($flag == "NOTOK"){
echo '<p><a href="images/fail.png" rel="lightbox" class="lightbox_trigger"></a></p>';
// echo "something is definitely wrong here";
}
?>
</html>