test.php
Copy Code code as follows:
<?php
$test = $_post[' test '];
Echo ' 12 ';
Echo $test;
echo $_post[' submit1 '];
echo $_post[' Submit2 '];
if (Isset ($_post[' submit1 ')) && $_post[' submit1 '] = = ' Submit1 ')
{
Echo ' Ok1 ';
}
if (Isset ($_post[' submit2 ')) && $_post[' submit2 '] = = ' Submit2 ')
{
echo "<meta Http-equiv=refresh content= ' 0; url=http://localhost:8000/php/index.php ' > ';
Header ("Location:index.php");
Break
Echo ' Ok2 ';
}
?>
Copy Code code as follows:
<body>
<form action= ' xajaxtest.php ' method= ' POST ' >
<input type= ' hidden ' name= ' test ' value= ' test1 ' >
<input name= ' submit1 ' type= ' Submit ' value= ' submit1 ' title= ' submit1 ' >
<input name= ' submit2 ' type= ' Submit ' value= ' submit2 ' title= ' submit2 ' >
</form>
</body>
Why does this test page not pass data for the first time after it is loaded?
echo $_post[' submit1 '];echo $_post[' submit2 ';
Then it's good. Is there any way to solve this problem?
Method Two:
<script language= "JavaScript" ><!--
function Check () {
Frm.action = "checkname.php"
}
function Mysubmit () {
Frm.action = "zhuce.php"
}
--></script>
<form method=post action= "" Name= "frm" >
<input type= "Submit" onclick= "Check ()" >
<input type= "Submit" onclick= "Mysubmit ()" >
</form>