input 之间怎么传递数据是在同一页面 本帖最后由 yulelcom2 于 2014-12-12 23:25:43 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script type="text/javascript">function add(){ document.getElementById('tfilename').value = document.getElementById('pripath').value + '' + document.getElementById('tfilename2').value;}</script><input name="tfilename" type="hidden" id="tfilename" value="<?=$pripath?><?=$tfilename2?>"> <td height="25" bgcolor="#FFFFFF">根目录</td><input name="pripath" type="text" id="pripath" value="<?=$pripath?>" size="30"><input name="tfilename2" type="text" id="tfilename2" value="<?=$tfilename2?>" size="16"><input type="button" name="b1" onclick="add()" value="传递" >点传递按钮。 <?phpheader("Content-type: text/html; charset=utf-8");$pripath = "c:\\windows\\";$tfilename2 = "test.txt";?><form action="" method="post" name="file_form" id="file_form"/><table> <tr> <input name="tfilename" type="hidden" id="tfilename" value="<?php echo $pripath; ?><?php echo $tfilename2; ?>" /> <td height="25" bgcolor="#FFFFFF">根目录</td> <input name="pripath" type="text" id="pripath" value="<?php echo $pripath; ?>" size="30"> <input name="tfilename2" type="text" id="tfilename2" value="<?php echo $tfilename2; ?>" size="16"> </tr> <tr> <td><input type="submit" name="submit"/></td> </tr></table></form><?phpif (isset($_POST['submit'])) { $pripath = $_POST['pripath']; $pripath = (!get_magic_quotes_gpc()) ? addslashes($pripath) : $pripath; $tfilename2 = $_POST['tfilename2']; $tfilename2 = (!get_magic_quotes_gpc()) ? addslashes($tfilename2) : $tfilename2; $str = "<script>\r\n"; $str .= "document.getElementById('tfilename').value = '{$pripath}{$tfilename2}';\r\n"; $str .= "document.getElementById('pripath').value = '{$pripath}';\r\n"; $str .= "document.getElementById('tfilename2').value = '{$tfilename2}';\r\n"; $str .= "</script>\r\n"; echo $str;}?> [求助] 请大家看看这个换行的问题 js中怎么调用php变量问题 post 提交问题 为什么我无法实现页面的跳转啊??? 多次查询排序的问题?请高手指点 用file_get_contents()函数有点慢,fsockopen函数可以取得某个网页的内容吗? php的ftp上传问题 请问PHP如何设置SESSION的超时? IIS 打开网站提示错误500 php-cgi.exe - FastCGI 进程意外退出 小白求教:php开发APP的问题? 请问PHP里XPath查找出数据后如何让它不返回数据结构只返回值? 求php远程抓取代码
<script type="text/javascript">
function add(){
document.getElementById('tfilename').value = document.getElementById('pripath').value + '' + document.getElementById('tfilename2').value;
}
</script><input name="tfilename" type="hidden" id="tfilename" value="<?=$pripath?><?=$tfilename2?>">
<td height="25" bgcolor="#FFFFFF">根目录</td>
<input name="pripath" type="text" id="pripath" value="<?=$pripath?>" size="30">
<input name="tfilename2" type="text" id="tfilename2" value="<?=$tfilename2?>" size="16">
<input type="button" name="b1" onclick="add()" value="传递" >
点传递按钮。
<?php
header("Content-type: text/html; charset=utf-8");
$pripath = "c:\\windows\\";
$tfilename2 = "test.txt";
?>
<form action="" method="post" name="file_form" id="file_form"/>
<table>
<tr>
<input name="tfilename" type="hidden" id="tfilename" value="<?php echo $pripath; ?><?php echo $tfilename2; ?>" />
<td height="25" bgcolor="#FFFFFF">根目录</td>
<input name="pripath" type="text" id="pripath" value="<?php echo $pripath; ?>" size="30">
<input name="tfilename2" type="text" id="tfilename2" value="<?php echo $tfilename2; ?>" size="16">
</tr>
<tr>
<td><input type="submit" name="submit"/></td>
</tr>
</table>
</form>
<?php
if (isset($_POST['submit'])) {
$pripath = $_POST['pripath'];
$pripath = (!get_magic_quotes_gpc()) ? addslashes($pripath) : $pripath;
$tfilename2 = $_POST['tfilename2'];
$tfilename2 = (!get_magic_quotes_gpc()) ? addslashes($tfilename2) : $tfilename2;
$str = "<script>\r\n";
$str .= "document.getElementById('tfilename').value = '{$pripath}{$tfilename2}';\r\n";
$str .= "document.getElementById('pripath').value = '{$pripath}';\r\n";
$str .= "document.getElementById('tfilename2').value = '{$tfilename2}';\r\n";
$str .= "</script>\r\n";
echo $str;
}
?>