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!

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料