如何在php中将数据发布到页面并导航到另一个页面
我将数据发布到一个页面,然后我想同时导航到另一个页面。我使用javascript发布数据,我检查它是否回显其值,当我只发送post数据时,它工作正常,但当我重定向到另一个页面并尝试访问这些post数据时,它似乎没有设置。 顺便说一下,我写的是这样的javascript如何在php中将数据发布到页面并导航到另一个页面,php,Php,我将数据发布到一个页面,然后我想同时导航到另一个页面。我使用javascript发布数据,我检查它是否回显其值,当我只发送post数据时,它工作正常,但当我重定向到另一个页面并尝试访问这些post数据时,它似乎没有设置。 顺便说一下,我写的是这样的javascript function getsupport ( selectedtype ) { document.folderCreation.supporttype.value=selectedtype; document.folderCrea
function getsupport ( selectedtype )
{
document.folderCreation.supporttype.value=selectedtype;
document.folderCreation.submit();
document.location.href=“../../index.php”
}
并以以下形式:
<form action="index.php" name="folderCreation" method="POST" >
<input type="hidden" name="supporttype" /><?php
while($row = mysql_fetch_array($rs))
{
$filePath=$row['pathFromImages'];
$id=$row['id'];
?>
<a href="javascript:getsupport('<?php echo $filePath;?>')" ><?php echo $filePath;?></a>
</br>
<?php
这段代码应该可以工作:
<form action="page2.php" method="POST">
<input type="text" name="a" onsubmit="postdata($(this)); return true;" />
<input type="submit" />
</form>
请接受你以前帖子上的答案,以增加你得到这个问题答案的机会。哦!我是新手,谢谢你的提示
function postdata(x){ $.post('page1.php', {a: x.a.val()}); }