douduiwei2831 2014-08-20 03:16
浏览 38

PHP GET没有从URL中检索%20(空格)的值

I'm trying to retrieve the "custom Phone" value from a form where the variables are being passed through a URL and then retrieved using the PHP Get method.

Here is the URL with the pass through variables:

http://domain.com/redirect.php?custom%20phone=555-555-5555&email=jk%40blackdiamondacademy%2ecom&from=jk%40blackdiamondacademy%2ecom&listname=fgxpressusa&meta_adtracking=&meta_message=1&meta_required=name%2cemail%2ccustom%20Phone&name=Jordan&submit=Submit&submit.x=121&submit.y=27

Here is the code on my landing page that has the Get PHP code:

<script type="text/javascript">
var sale = PostAffTracker.createAction('lead');
sale.setOrderID('<?php echo $_GET['meta_message']; ?>');
sale.setProductID('<?php echo $_GET['unit']; ?>');
sale.setData1('<?php echo $_GET['name']; ?>');
sale.setData2('<?php echo $_GET['email']; ?>');
sale.setData3('<?php echo $_GET['custom%20phone']; ?>');
PostAffTracker.register();
</script>

The code retrieves the "name", and "email" but not the "custom%20phone". I tried putting 'custom phone' as the get value as well as 'custom+phone' and still it doesn't retrieve it.

The issue seems to be the space in the value from my web form ("custom Phone") that is being passed through the URL as "custom%20phone".

Any help would be greatly appreciated!

  • 写回答

1条回答 默认 最新

  • doujishan2247 2014-08-20 03:37
    关注

    I just found the answer to my own question through trial and error.

    The PHP GET method translates %20 as an underscore so I put:

    <?php echo $_GET['custom_phone']; ?>
    

    Works perfect!

    评论

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b