form提交不能获得参数,这是怎么回事?php4.x没问题

hahacc 2004-12-15 04:27:02
这是怎么回事?代码在php4.x中没问题啊!
我用的php5.0.2
代码如下:
<?
echo $algorithm1;
if ($algorithm!='')
{
exit();
}
if ($algorithm=="1")
{
$result=additional($a,$b);
}
if ($algorithm=="2")
{
$result=subtrational($a,$b);
}
if ($algorithm=="3")
{
$result=multiplicational($a,$b);
}
if ($algorithm=="4")
{
$result=divisional($a,$b);
}
function additional($a,$b)
{
$result=$a+$b;
return $result;
}
function subtrational($a,$b)
{
$result=$a-$b;
return $result;
}
function multiplicational($a,$b)
{
$result=$a*$b;
return $result;
}
function divisional($a,$b)
{
$result=$a/$b;
return $result;
}

?>
<form name="form1" method="post" action="">
algorithm:
add <input type="radio" name="algorithm1" value="1" <?if ($algorithm=="1") echo "checked"?>>
sub <input type="radio" name="algorithm1" value="2" <?if ($algorithm=="2") echo "checked"?>>
mult <input type="radio" name="algorithm1" value="3" <?if ($algorithm=="3") echo "checked"?>>
div <input type="radio" name="algorithm" value="4" <?if ($algorithm=="4") echo "checked"?>><br>
the first value: <input type="text" name="a" value="<?echo $a?>"><br>
the second value: <input type="text" name="b" value="<?echo $b?>"><br>
the result value: <input type="text" name="result" value="<?echo $result?>"><br>
<input type="submit" name="submit1" value="submit"><br>

</form>
...全文
129 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
bbjt 2004-12-15
  • 打赏
  • 举报
回复
这应该是一个关于register_globals的问题,建议你看一下php的手册.

fzjw 2004-12-15
  • 打赏
  • 举报
回复
HELM代码中设置页面编码即可,可以不用Header
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
</head>
kozzi 2004-12-15
  • 打赏
  • 举报
回复
为什么不能显示中文?=>

会不会跟浏览器或页面编码有关?
-神仙- 2004-12-15
  • 打赏
  • 举报
回复
编码问题
hahacc 2004-12-15
  • 打赏
  • 举报
回复
另外,要让页面显示中文除了

header('Content-type: image/png');

还有别的方法吗?
为什么不能显示中文?
fzjw 2004-12-15
  • 打赏
  • 举报
回复
修改php.ini后,必须重启Apache,否则更改不能生效
hahacc 2004-12-15
  • 打赏
  • 举报
回复
重启了一下apache又好了!昏……
hahacc 2004-12-15
  • 打赏
  • 举报
回复
我打开了,用$_POST['变量名']也不行
westdo 2004-12-15
  • 打赏
  • 举报
回复
是不是php.ini文件的全局变量没有打开啊.可用 $_POST['变量名'],获得变量的值

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧