在A.php中有个表单,submit会打开一个新的页面B.php,A网页不关闭。
然后在B.php里$_POST['name'];就是获取不到A.php中的值,但是在A.php中,能够在网页输出$_POST['name']。
求各位大神指教,怎么才能在新打开的网页B.php中取得A中表单的值?
看看你的表单代码
看看你的表单代码
<form action='' method='POST' > <input type='hidden' value=<?php echo $node->getId() ?> name='nodeIdinfo'> <input type="submit" value="AP信息" name='showNdinfo' onclick="manageAp('<?php echo gethostbyname($_SERVER["SERVER_NAME"]); ?>')"> </form> </td> </tr><?php endforeach ?></table><script type="text/javascript" > function manageAp(url){ window.open("http://"+url+"/phpinfo.php","","fullscreen=1"); }
<?php if ($_POST['showNdinfo']){ echo $_POST['nodeIdinfo']; }else { echo "failed"; }?>
看看你的表单代码
<form action='<?php echo gethostbyname($_SERVER["SERVER_NAME"]); ?>' method='POST' target=window.open("","","fullscreen=1")> <input type='hidden' value=<?php echo $node->getId() ?> name='nodeIdinfo'> <input type="submit" value="AP信息" name='showNdinfo'> </form>
<form action='<?php echo gethostbyname($_SERVER["SERVER_NAME"]); ?>' method='POST' target=window.open("","","fullscreen=1")> <input type='hidden' value=<?php echo $node->getId() ?> name='nodeIdinfo'> <input type="submit" value="AP信息" name='showNdinfo'> </form>
<form action='<?php echo gethostbyname($_SERVER["SERVER_NAME"]); ?>' method='POST' target=window.open("","","fullscreen=1")> <input type='hidden' value=<?php echo $node->getId() ?> name='nodeIdinfo'> <input type="submit" value="AP信息" name='showNdinfo'> </form>
少了个 /phpinfo.php 你自己补上就是了