0
我使用PHP中的会话变量从一个页面传递布尔值到另一个页面,第二页是为了显示结果,如果提交表单,我想触发提交按钮,如果布尔是真实的,并自动显示结果,(回声),但如果错误,页面应显示为其意图。由于我是新来的,请帮忙!另外,我对Ajax并不熟悉。使用会话变量触发提交按钮
感谢
<?php
session_start();
if(isset($_SESSION['answer'])) {
$v11=$_SESSION['answer'];//boolean value
}
$q=100;
$f=200;
$r=300;
?>
<link rel="stylesheet" type="text/css" href="../../styles/messages.css" />
<html>
<table cellpadding="0" cellspacing="0" border="0">
<form action="" name = "page0" method="GET" enctype="multipart/form- data">
<tr >
<td colspan= > ID </td><br>
<td colspan="2" size="30"> NAME </td>
<td colspan="3" size="50" > MACH </td>
</tr>
<tr>
<td colspan=><input type="text" name="ID" class="rw" value="<?php $phpvar=$v11; echo $phpvar; ?>"></td>
<td colspan="2" ><input type="text" name="NAME" class="rw" size="30" value="<?php $phpvar=$f; echo $phpvar; ?>"></td>
<td colspan="2"><input type="text" name="MACH" class="rw" size="70" value="<?php $phpvar=$r; echo $phpvar; ?>"></td>
</tr>
<input type="submit" button class="button" value="Calculate" name="second_call" onclick= "document.write('<?php hello(); ?>');" />
</form>
</table>
</html>
<?php
function hello()
{
//some operation using values q, f, r
echo(result);
//i want this echo to work when i click submit on the previous page from where im redirecting here if v11=true
}
?>
你能后的样本你的代码? – meucaa
我编辑过! –