我想你在找什么是使用隐藏的输入,让您的变量从一个页面传递到页面。
使用类似这样的形式:
<form method='get'>
<input type='hidden' name='client' value='1'>
// Your other inputs
</form>
这样,当你得到一个输入,你可以使用一些简单的PHP代码保持从页传递到页把它捡起来从URL和显示器它再次根据需要。
编辑:(进一步说明)
当你通过URL从一个网页传递到另一个数据可以用一些简单的PHP代码,看看是否有存在进一步把它传递 - 这样的:
<?php //page1.php
if(isset($_GET['user']))
{
$user=htmlspecialchars($_GET['user']);
}
if(isset($_GET['photo']))
{
$photo=htmlspecialchars($_GET['photo']);
}
// Check for anything else you want as needed.
?>
那么,究竟让你的链接时,你可以这样做:
<?php
$baseAddress="<a href='thePageIwant.php?thisVar=3";
if(isset($user))
{
$baseAddress.="&user=".$user;
}
if(isset($photo))
{
$baseAddress.="&photo=".$photo;
}
// Add any other variables as needed
$baseAddress.="'>
?>
在网页的HTML输出部分,你可以使用这个:
<p>Some text and then a link <?php echo $baseAddress;?>Your Link Text</a></p>
而且您的链接将与其他所有通过URL传递的变量一起出现。在这种情况下,如果用户被传递到页面ID为4,和照片传递到页面ID为6,HTML输出将是:
<p>Some text and then a link <a href='thePageIwant.php?thisVar=3&user=4&photo=6'>Your Link Text</a></p>
如果只有用户是在URL过去了,没有photo=6
输出会是这样的:
<p>Some text and then a link <a href='thePageIwant.php?thisVar=3&user=4'>Your Link Text</a></p>
我不知道你在问什么。 – David 2012-07-28 02:06:03
你在问如何通过URL传递参数吗? – dykeag 2012-07-28 02:09:33
嗨,对不起,我刚刚看到如何接受awirs:s – user1148875 2012-07-28 02:14:46