您可以使用sessions来实现此目的。
您在这里有一个语法错误。
<td>".$row["name"]."</td> </tr>
它应由
<td><?php echo $row['name'] ?></td> </tr>
固定[或方式手帕웃Panky建议]
您可以通过
<?php
session_start();
$_SESSION['name'] = $row['name']
?>
有它在你的会话和检索它通过
另一页
<?php
session_start();
echo $_SESSION['name'];
?>
更新:
如果你有这个在您的网址,您希望您的tp_no
全球可用,那么你应该更换$row['name']
通过$_GET['tp_no']
http://localhost:88/web/SMSindex.php?tp_no={%27tel:94771122336%27}
你应该
得到tp_no
$_GET['tp_no']
但是我不知道你换衣服的原因第二{}
更新:
当你不希望看到页面的URL。
这里有一个微小的变通方法来克服它。
<?php
session_start();
if (isset($_GET['tp_no']))
{
$_SESSION['tp_no'] = $_GET['tp_no'];
unset($_GET['tp_no']);
$url = $_SERVER['SCRIPT_NAME'].http_build_query($_GET);
header("Refresh:0; url=".$url);
}
elseif (isset($_SESSION['tp_no']))
{
echo $_SESSION['tp_no'];
session_unset();
session_destroy();
}
else
{
echo "Direct/Illegal Access not allowed";
}
?>
的解释版本
<?php
session_start(); #Starting the Session
if (isset($_GET['tp_no'])) #Checking whether we have $_GET value from the url
{
$_SESSION['tp_no'] = $_GET['tp_no']; # We are assiging the tp_no to session
unset($_GET['tp_no']); #Here we are unsetting the value that we get from url
$url = $_SERVER['SCRIPT_NAME'].http_build_query($_GET); #Here we are removing gettgint the url and removing the tp_no from it
header("Refresh:0; url=".$url); #Now we are redirecting/refreshing the page with tp_no - As you said you need it :)
}
elseif (isset($_SESSION['tp_no']))
#Here is the else if condition once we refresh the page we won't have $_GET so the it will come inside this loop
{
echo $_SESSION['tp_no']; #Displaying the value that is from the session
session_unset(); #Unsetting the session value for secure
session_destroy(); #Destroying the entire session value for secure
}
else
{
#The compiler will come to this part if both session or url is not set, So this is illegal area
echo "Direct/Illegal Access not allowed";
#There might be some hackers/genius persons who will try to access directly this page, to avoid them we are showing them the above warning message
}
?>
不,这是正确的方式,一些小的修正之后。 '{$ row ['tel']}'因为它在字符串 –
内被使用,但我们可以在URL中看到电话号码。我不需要显示 – shanthini
然后将其存储在会话变量中,并在其他页面访问 –