dqef7931 2014-09-18 16:58
浏览 26

将PHP POST数据用于移动设备是否存在已知问题?

I have a PHP form that self processes. It passes data with POST. Works flawlessly on desktop browsers but does not work on Chrome for Android, Safari or Chrome for iOS and iOS simulator. For the sake of brevity, I will share the parts of this file that are not working as there is quite a bit of validation that goes on.

Here is the beginning of my HTML form input:

<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">

<div class="voucher-input first-input">
Voucher 1: <input maxlength="20" type="text" name="voucher1" id="voucher1" title="Voucher" class="input" value="<?php echo $voucher1;?>">

Here is the receiving part of my form "action" that captures POST data:

$voucher1 = test_input($_POST["voucher1"]);

When it captures this voucher1, it passes it off for form validation. The first step is to remove white space and illegal characters, then it ensures that the voucher is prefixed with a valid 3 letter prefix (in this case I am using STL). If that passes, then it goes through the trouble of adding it to a PHP array.

$stl = 'STL'; // Defines a string that is needed for the next step

$posstl = strpos($voucher1, $stl); // Checks if 'STL' is at beginning of $voucher1 input. All vouchers must start with an authorized prefix.

    if ($posstl === 0) { // If STL is at the beginning of position 0 of string


    /** Create Empty Voucher Array **/
    $redeemids = array();

    echo "Adding voucher to array";
    array_push($redeemids, $voucher1);
    print_r($redeemids);}

On desktops, it does all of this. On mobile, it doesn't even echo "Adding voucher to array" which tells me it is failing the IF conditional for mobile devices. So to eliminate the variables, either this method of POST does not work for mobile, my form HTML is invalid or the there is a problem with my conditional. Any ideas?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
    • ¥20 关于URL获取的参数,无法执行二选一查询
    • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
    • ¥15 marlin编译错误,如何解决?
    • ¥15 有偿四位数,节约算法和扫描算法
    • ¥15 VUE项目怎么运行,系统打不开
    • ¥50 pointpillars等目标检测算法怎么融合注意力机制
    • ¥20 Vs code Mac系统 PHP Debug调试环境配置
    • ¥60 大一项目课,微信小程序
    • ¥15 求视频摘要youtube和ovp数据集