表单提交的问题! 好像~直接名字不同PHP变量就不同咯 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 switch ("按钮"){case "提交一": ..... break;case "提交二": ..... break;case "重写": ..... } <?php/*simple code*/$a=trim($_POST['a']);$b=trim($_POST['b']);if ($_POST['qh']){ $result=$a+$b;}elseif ($_POST['qc']){ $result=$a-$b;}echo "$result";?><form name="test" method="POST" action=""><input name="a" type="text"><input name="b" type="text"><input name="qh" type="submit" value="求和"><input name="qc" type="submit" value="求差"><input name="reset" type="reset" value="重写"></form> <script language="javascript">function checkSub(str){if (str == 'qu0'){ document.forms[0].action = 'test1.php'; return true;}if (str == 'qu1'){ document.forms[0].action = 'test2.php'; return true;}}</script><form name="test" method="post"><input type="submit" name="qh0" value="提交一" onclick="return checkSub('qu0');"><input type="submit" name="qh1" value="提交二" onclick="return checkSub('qu1');"><input name="reset" type="reset" value="重写"> </form> 判断QQ号和手机哪种方法更好 file_get_contents()乱码问题 PHP 模糊查询分页代码问题? 急 最近要用PHP做个仓库管理系统了,需要用到报表,求助做过的高人....指点迷津! 请教批量替换问题 怎么实现文件或歌曲下载啊,在线等。 求助:Can't locate WWW/Curl/easy.pm in @INC sql语句中能否直接把截取的字符串当作where条件 Zencoder Plus 1.2发布,加密PHP源码IDE!! 怎么样生成动态图形? 奇怪的cookie问题,有时有,有时无 select 时间数据的问题。
{
case "提交一":
.....
break;
case "提交二":
.....
break;
case "重写":
.....
}
/*
simple code
*/$a=trim($_POST['a']);
$b=trim($_POST['b']);
if ($_POST['qh'])
{
$result=$a+$b;
}
elseif ($_POST['qc'])
{
$result=$a-$b;
}echo "$result";
?><form name="test" method="POST" action="">
<input name="a" type="text">
<input name="b" type="text">
<input name="qh" type="submit" value="求和">
<input name="qc" type="submit" value="求差">
<input name="reset" type="reset" value="重写">
</form>
<script language="javascript">
function checkSub(str){
if (str == 'qu0'){
document.forms[0].action = 'test1.php';
return true;
}
if (str == 'qu1'){
document.forms[0].action = 'test2.php';
return true;
}}
</script>
<form name="test" method="post">
<input type="submit" name="qh0" value="提交一" onclick="return checkSub('qu0');">
<input type="submit" name="qh1" value="提交二" onclick="return checkSub('qu1');">
<input name="reset" type="reset" value="重写">
</form>