<input type=text name=q_name maxlength=15 value='$_GET[q_name]'>
解决方案 »
- 怎么样把URL路径模式的地址 传给<a></a>中的href 让他执行一个controlled类中的方法...
- php时间格式
- 如何在程序里面自动换ip地址呢
- apache+fastcgi+php模式,怎样实现socket长连接,象mysql_pconnect函数这样
- 【求助】php新手问题,用zend studio连接Oracle出错。
- 请教一个关于类中的多态的问题
- 返回为什么总是0
- 请教iis下安装php的问题。
- 求新闻发布系统
- 我下了一个php的集成的安装包,装了之后怎么还是不能运行,请多指教
- 在PHP中使用InterBase6.5作数据后台,在写论坛中分页显示是怎么处理的?
- 请问如何获取目录的大小?
<?php
echo "
<body onload = SetValue()>
...
<script language = javascript>
function SetValue(){
document.frm_a.q_name.value = '$_GET[q_name]';
}
</script><form name = frm_a>
...
<input type=text name=q_name maxlength=15>
<input type=submit>
</form>
";
?>
执行后填入123
提交
查看源文件
可见
<body onload = SetValue()>
...
<script language = javascript>
function SetValue(){
document.frm_a.q_name.value = '123'; //已经在这里了
}
</script><form name = frm_a>
...
<input type=text name=q_name maxlength=15>
<input type=submit>
</form>不过若你的php版本低于4.1.0那么
$_GET 就要写作 $HTTP_GET_VARS
echo "function SetValue(){";
echo "document.frm_a.q_name.value = '".$_GET[q_name]."'";
echo "}";
echo "</script>";
echo "
<html>
<body onload = SetValue()>
<script language = javascript>
function SetValue(){
document.frm_a.q_name.value='$_HTTP_GET_VARS[q_name]";
}
</script><form name = frm_a>
<input type = text name = q_name maxlength = 15>
<input type = submit>
</form>
</html>
";
?>submit了以后,我看到的是document.frm_a.q_name.value = '';没有值啊!
<input type = text name = q_name maxlength = 15>
<input type = submit>
</form>加上method="GET"试试?
echo "
<html>
<body onload = SetValue()>
<script language = javascript>
function SetValue(){
document.frm_a.q_name.value='$_HTTP_GET_VARS[q_name]";//这句有问题吧,'$_HTTP_GET_VARS[q_name]";引号不对称哦……
}
</script>
<body onload = SetValue()><script language = javascript>
function SetValue(){
document.frm_a.q_name.value = '$_GET[q_name]';
}
</script>$q_name <form name = frm_a><input type=text name=q_name maxlength=15>
<input type='submit' name='submit' value='提交'></form>
";
?>可以啊
echo "
<html>
<body onload = SetValue()>
<script language = javascript>
function SetValue(){
document.frm_a.q_name.value='$HTTP_GET_VARS[q_name]';
}
</script><form name = frm_a>
<input type = text name = q_name maxlength = 15>
<input type = submit>
</form>
</html>
";
?>提交以后再看
register_globals = on
document.frm_a.q_name.value = '$HTTP_GET_VARS[q_name]';
}
是这样写的吗?
<?phpecho "
<body onload = SetValue()><script language = javascript>
function SetValue(){
document.frm_a.q_name.value = '$HTTP_GET_VARS[q_name]';
}
</script><form name = frm_a><input type=text name=q_name maxlength=15>
<input type='submit' name='submit' value='提交'></form>$q_name
";
?>
结果是:
<body onload = SetValue()><script language = javascript>
function SetValue(){
document.frm_a.q_name.value = '111111111'; //看有啊。
}
</script><form name = frm_a><input type=text name=q_name maxlength=15>
<input type='submit' name='submit' value='提交'></form>111111111