为什么会执行2次啊 把你的PHP脚本放到HTML静态代码后面. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head><meta http-equiv="Content-Language" content="en" /><meta name="GENERATOR" content="PHPEclipse 1.0" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>title</title></head><?php if(isset($_POST["submit"])) { ?><script>alert("success");</script><?php } else { ?><script>alert("fail");</script><?php } ?><body> <form name="form" method="post"> <input type="submit" name="submit" value="close"> </form></body></html>原因:语言声明应出现在页面的内容的 <html><head><meta http-equiv="Content-Language" content="en" /><meta name="GENERATOR" content="PHPEclipse 1.0" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>title</title></head><body> <form action="text.php" name="form" method="post"> <input type="submit" name="submit" value="close"> </form></body></html><?php if(isset($_POST["submit"])) { ?> <script language=javascript> alert("success"); </script> <?php } else { ?> <script>alert("fail");</script> <?php }?> 这样可以提交后弹出窗口撒。<?phpif(isset($_POST["submit"])){?><script>alert("success");</script><?php}else{?><script>alert("fail");</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><body> <form action="test.php" name="form" method="post"> <input type="submit" name="submit" value="close"> </form></body></html><?php} ?> 同意楼上的,不过也可以分成2个文件,test.php和xx.html php和ajax做的网页如何保证安全? 怎样用js刷新验证码页面(php做的) 现在做一个网站需要多少钱(商城+门户+企业站) Discuz在哪下啊 (菜鸟飞飞)问个页面之间传值的问题 求救啊,浏览器端与Mysql的中文字符处理问题 求大神指点成就系统设计 在64位windows7上该装哪个php_imagick.dll? php怎样实现文件上传? php建立socket出现broken pipe 谁有好用的OA系统, url重写问题求助?
<head>
<meta http-equiv="Content-Language" content="en" />
<meta name="GENERATOR" content="PHPEclipse 1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>title</title>
</head><?php
if(isset($_POST["submit"]))
{
?><script>alert("success");</script><?php
}
else
{
?><script>alert("fail");</script><?php
}
?>
<body>
<form name="form" method="post">
<input type="submit" name="submit" value="close">
</form>
</body>
</html>
原因:
语言声明应出现在页面的内容的
<head>
<meta http-equiv="Content-Language" content="en" />
<meta name="GENERATOR" content="PHPEclipse 1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>title</title>
</head>
<body>
<form action="text.php" name="form" method="post">
<input type="submit" name="submit" value="close">
</form>
</body>
</html><?php
if(isset($_POST["submit"]))
{
?>
<script language=javascript>
alert("success");
</script>
<?php
}
else
{
?>
<script>alert("fail");</script>
<?php
}
?>
if(isset($_POST["submit"]))
{
?>
<script>alert("success");</script>
<?php
}
else
{
?>
<script>alert("fail");</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body>
<form action="test.php" name="form" method="post">
<input type="submit" name="submit" value="close">
</form>
</body>
</html>
<?php
}
?>