dou11655853 2013-03-31 10:43
浏览 28

传递其值可以每次更改的变量,从php页面到另一个页面

I have a form from which i'm getting the values of two variables say username and password using POST method.

$Username=$_POST['Username'];
$Password=$_POST['Password'];

I tried passing these variables to another php page using the following code.

<a href="abc.php?Username=$Username & Password=$Password">Click here</a>

In the other page,i tried printing the variable as follows.

$User=$_GET['Username'];
echo $USer;

But,I didn't get the value stored in the varible. Instead,its printing "$Username" as the value as given in the anchor tag.

I just need to print the value stored in the variable $Username.

Please, help. Thanks in advance.

  • 写回答

4条回答 默认 最新

  • doudu4282 2013-03-31 10:46
    关注

    You're looking for the following:

    <a href="abc.php?Username=<?php echo $Username; ?>&Password=<?php echo $Password; ?>">Click here</a>
    

    Although you should be careful if the variables contain special characters. So I'd advise using:

    <?php echo urlencode($Username); ?>
    
    <?php echo urlencode($Password); ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 如何将下列的“无限压缩存储器”设计出来
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口