<!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=UTF-8">
<title>Inserttitlehere</title>
</head>
<body>
<formaction="index.php"method="post">
<inputtype="text"name="name"/>
<inputtype="submit"value="submit"id="submit"/>
</form>
<scripttype="text/javascript">
document.getElementById("submit").onclick=functionsub(event){
if(event&&event.preventDefault){
event.preventDefault();
}else{
window.event.returnValue=false;//注意加window
}
}
</script>
</body>
</html>
<?php
if($_POST&&$_POST['name']){
echo$_POST['name'];
}