问个字符和变量组合问题 当 $pre="r" 时正常,但当 $pre="_POST" 时就取不到表单传来的值,是怎么回事呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ${$pre}['abc'];试试和php.ini中设置有关. 试过也是不行,直接用 $_POST['abc'] 是可以取到值的,但用上面的组合就总是空,输出 $pre 的值发现是正确的 _POST 是吗?<form method=post><input name=a value=3><input type=submit></form><?php$p = "_POST";echo ${$p}['a'];?> 我都不知是什么回事了:(我提交 1234,然后用 <?echo $pre;?> | <?echo ${$pre}['abc'];?> | <?echo $_POST['abc'];?> 做测试,结果输出结果 _POST | |1234,还是取不到值:( <html><head><title></title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script>function submitchoice(){ editform.method="post" editform.action="editstu.php?action=listchoice" editform.submit();}</script><link href="images/main.css" rel="stylesheet" type="text/css"></head><?function stuinfo($formaction){ if($formaction=="fromform"){ require('global.php'); require('function.php'); $pre = "_POST"; } if($formaction=="fromdb"){ require('global.php'); require('function.php'); mysql_select_db($mysql_data); $query="select * from ".$table_stuinfo_base." where id='".$_REQUEST['id']."'"; $result=mysql_query($query); $r=mysql_fetch_array($result); $pre="r"; }?><body bgcolor="#E6F3FF"><form name="editform" method="post" action="editstu.php?action=save"> <table width="550" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#FFFFFF"><table width="100%" border="0"> <tr bgcolor="#B5DBFF"> <td height="25" colspan="4"><div align="center"><strong>学生基本信息处理</strong></div></td> </tr> <tr bgcolor="#DAEDFF"> <td width="20%" bgcolor="#DAEDFF"><div align="left">学 籍 号</div></td> <td width="30%" bgcolor="#E6F3FF"><input name="xjh" type="text" size="20" value="<?echo ${$pre}['xjh'];?>"></td> <tr bgcolor="#DAEDFF"> <td width="20%" bgcolor="#DAEDFF"><div align="left">籍 贯 码</div></td> <td colspan="3" bgcolor="#E6F3FF"><select name="jgm" id="select3" onchange="submitchoice();"> <?showchoice($table_GB_T2260,$_POST['jgm']); // 读取籍贯码?> </select> <div align="left"></div></td> </tr> <tr bgcolor="#DAEDFF"> <td bgcolor="#DAEDFF">出生地码</td> <td colspan="3" bgcolor="#E6F3FF"><select name="csdm" id="select"> <?listchoice($table_GB_T2260a,$_POST['jgm']); // 读取出生地码?> </select></td> </tr> <tr bgcolor="#DAEDFF"> <td height="25" colspan="4" bgcolor="#DAEDFF"><div align="center"> <input type="submit" name="Submit" value="提 交"> <input type="reset" name="Submit2" value="重 写"> </div></td> </tr> </table></td> </tr> </table></form></body><?mysql_close();}?></html><?require('global.php');mysql_select_db($mysql_data);if($_REQUEST['action']=='save'){}elseif($_REQUEST['action']=='listchoice'){ $formaction="fromform"; stuinfo($formaction);}else{ $formaction="fromdb"; stuinfo($formaction);}?> 表单提交乱码问题 双搜索框数据库搜索? php执行exec("aapt v",$output) PHP的session与cookie问题 php能自己写登陆界面登陆到其他页面上吗 如何通过一个URL得到它的所有连接。 php如何返回SQL Server的游标的运行结果? 怎样可以重新刷新? 谁能给我详细解释一下这句话的意思 使用zend studio 编写php代码时很卡怎么办 各位朋友,使用header()有什么要注意的啊? 谁熟练 PHP?
<form method=post>
<input name=a value=3>
<input type=submit>
</form><?php
$p = "_POST";
echo ${$p}['a'];
?>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
function submitchoice(){
editform.method="post"
editform.action="editstu.php?action=listchoice"
editform.submit();
}
</script>
<link href="images/main.css" rel="stylesheet" type="text/css">
</head>
<?
function stuinfo($formaction){
if($formaction=="fromform"){
require('global.php');
require('function.php');
$pre = "_POST";
}
if($formaction=="fromdb"){
require('global.php');
require('function.php');
mysql_select_db($mysql_data);
$query="select * from ".$table_stuinfo_base." where id='".$_REQUEST['id']."'";
$result=mysql_query($query);
$r=mysql_fetch_array($result);
$pre="r";
}
?>
<body bgcolor="#E6F3FF">
<form name="editform" method="post" action="editstu.php?action=save">
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0">
<tr bgcolor="#B5DBFF">
<td height="25" colspan="4"><div align="center"><strong>学生基本信息处理</strong></div></td>
</tr>
<tr bgcolor="#DAEDFF">
<td width="20%" bgcolor="#DAEDFF"><div align="left">学 籍 号</div></td>
<td width="30%" bgcolor="#E6F3FF"><input name="xjh" type="text" size="20" value="<?echo ${$pre}['xjh'];?>"></td>
<tr bgcolor="#DAEDFF">
<td width="20%" bgcolor="#DAEDFF"><div align="left">籍 贯 码</div></td>
<td colspan="3" bgcolor="#E6F3FF"><select name="jgm" id="select3" onchange="submitchoice();">
<?showchoice($table_GB_T2260,$_POST['jgm']); // 读取籍贯码?>
</select> <div align="left"></div></td>
</tr>
<tr bgcolor="#DAEDFF">
<td bgcolor="#DAEDFF">出生地码</td>
<td colspan="3" bgcolor="#E6F3FF"><select name="csdm" id="select">
<?listchoice($table_GB_T2260a,$_POST['jgm']); // 读取出生地码?>
</select></td>
</tr>
<tr bgcolor="#DAEDFF">
<td height="25" colspan="4" bgcolor="#DAEDFF"><div align="center">
<input type="submit" name="Submit" value="提 交">
<input type="reset" name="Submit2" value="重 写">
</div></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
<?
mysql_close();
}
?>
</html>
<?
require('global.php');
mysql_select_db($mysql_data);
if($_REQUEST['action']=='save'){}elseif($_REQUEST['action']=='listchoice'){
$formaction="fromform";
stuinfo($formaction);
}else{
$formaction="fromdb";
stuinfo($formaction);
}
?>