register_globals 问题?菜鸟求救php

来源:百度知道 编辑:UC知道 时间:2024/05/08 00:05:29
问个问题details.php
<form action='bid.php?<?php echo "gid=$gid"?>'method='post'>
<input type='submit' name='bid' value="出价">
</form>
bid.php
<form action='bid.php?hasbid=1&<?php echo "gid=$gid"?>' method='post'>
价格<input type='input' name='price'>
<input type='submit' name='bid' value="确定">
</form>
1.<?php echo "gid=$gid"?>有什么作用?
2.在bid.php中可以获得gid的值吗?
3.如果register_globals = off,两个表单的action应该怎么写?
4.register_globals =on为什么bid.php能够获得值
5.register_globals作用?

1. 作用不清楚,应该只是个参数。根据该参数获得相关数据
2. 在你的程序看来,可以是可以
3. 在最下面看
4. 表单里的数据库都成了全局变量
5. 自动把表单里的数据作为全局变量,一般都OFF,安全一点,要不别人可以在你url加参数就提交了。

在off的时候,表单method=post的时候,获取表单里数据的方法就是$_POST["xxx"],xxx是表单里那些input什么的名字。
method=get的时候就是$_GET["xxx"]

details.php
<form action='bid.php'method='post'>
<input type='submit' name='bid' value="出价">
<input type="hidden" name="gid" value="<?=$gid?>">
</form>
bid.php
<form action='bid.php?hasbid=1&<?php echo "gid=$_POST[gid]"?>' method='post'>
价格<input type='input' name='price'>
<input type='submit' name='bid' value="确定">
</form>