Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php $\u POST返回一个数组_Php_Html_Arrays_Post - Fatal编程技术网

Php $\u POST返回一个数组

Php $\u POST返回一个数组,php,html,arrays,post,Php,Html,Arrays,Post,我最近发了一篇$\u的帖子 当我写作时: print_r($_POST['nb_acces']); $nb_acces = $_POST['nb_acces']; print_r($nb_acces ) 我得到: 一, 这是我在表单中写的值 但如果我写: print_r($_POST['nb_acces']); $nb_acces = $_POST['nb_acces']; print_r($nb_acces ) 我得到: 数组([nb]=>0) 它以前是有效的,现在我不明白发生了什么。

我最近发了一篇$\u的帖子

当我写作时:

print_r($_POST['nb_acces']);
$nb_acces = $_POST['nb_acces'];
print_r($nb_acces )
我得到:

一,

这是我在表单中写的值

但如果我写:

print_r($_POST['nb_acces']);
$nb_acces = $_POST['nb_acces'];
print_r($nb_acces )
我得到:

数组([nb]=>0)

它以前是有效的,现在我不明白发生了什么。可能是服务器配置还是其他原因

编辑:

我的意见:

<form id='sous_paiement' name='sous_paiement' method='post' action='commande_enregistre_test.php?ecole=<?php echo $id_ecole; ?>'>
    <input id='nb_acces' name='nb_acces' style='width:90px;border:1px solid black;padding-left:4px;text-align:center;' />
是否可以用此替换

编辑2----------------------------------

那么整个形式呢,

<form id='sous_paiement' name='sous_paiement' method='post' action='commande_enregistre_test.php?ecole=<?php echo $id_ecole; ?>'>
      <div class="div_categories">
        <p style='margin:0;padding:3px;padding-left:60px;'>Indiquez le <strong>nombre d'accès</strong> que vous souhaitez acheter :</p>
      </div>

      <br />
      <div id="erreur_nb_acces" style="color:red;"><br /></div>


      <table style='border-collapse:collapse;'>
        <tr style='font-weight:bold;border:1px solid #eee;background-color:white;'>
          <td style='width:200px;padding-left:10px;'>Nombre d'accès</td>
          <td style='width:100px;padding-left:10px;padding-right:10px;'><input id='nb_acces' name='nb_acces' type="text" style='width:90px;border:1px solid black;padding-left:4px;text-align:center;' /></td>
        </tr>
      </table>

      <br />

      <table style='border-collapse:collapse;'>
        <tr style='border:1px solid #eee;background-color:white;border-bottom:1px solid #999;'>
          <td style='width:200px;padding-left:10px;'>Prix par accès</td>
          <td style='width:100px;padding-left:10px;padding-right:10px;text-align:right;'><div id='div_prix_unitaire' style='display:inline;'>-</div> &euro;</td>
        </tr>
        <tr style='font-weight:bold;border:1px solid #999;background-color:white;'>
          <td style='width:200px;padding-left:10px;'>PRIX TOTAL</td>
          <td style='width:100px;padding-left:10px;padding-right:10px;text-align:right;'><div id='div_prix_total' style='display:inline;'>-</div> &euro;</td>
        </tr>
      </table>

      <div style='width:190px;margin-top:5px;'>
        <a href='#' onclick='ouvrirPopUp_tarifs();'><img src='../images/IconeInformation.png' style='border:0px solid red;float:left;display:inline;' /><span style="line-height:24px;">Consulter les tarifs</span></a>
      </div>
      <div style="clear:both;"></div>

      <br /><br />
      <div class="div_categories">
        <p style='margin:0;padding:3px;padding-left:60px;'>Choisissez votre <strong>mode de paiement</strong> :</p>
      </div>

      <br /><br />

      <table class="tab_mode_paiement" style="border-collapse:collapse;">
        <tr>
          <td>
            <input id='paiement_cb' name='mode_paiement' value='5' class='eleves' type='radio' checked="checked" style="cursor:pointer" />
          </td>
          <td style="font-weight:bold;padding-right:80px;border-right:1px solid #999;">
            <label for='paiement_cb' style="cursor:pointer">
              <img src="../images/ic_cb.jpg" style="float:left;display:inline;padding-right:10px;" /> Carte bancaire
            </label>
          </td>
          <td style="padding-left:40px;">
            <!--<input id='paiement_paypal' name='mode_paiement' value='3' class='eleves' type='radio' style="cursor:pointer" />-->
          </td>
          <td style="font-family:arial;font-size:20px;padding-right:120px;">
            <!--<label for='paiement_paypal' style="cursor:pointer">
              <span style="color:rgba(0,3,128,1)">Pay</span><span style="color:rgba(0,158,210,1)">Pal</span>
            </label>-->
          </td>
          <td>
            <input id='paiement_virement' name='mode_paiement' value='1' class='eleves' type='radio' style="cursor:pointer" />
          </td>
          <td style="font-weight:bold;">
            <label for='paiement_virement' style="cursor:pointer">
              Par virement bancaire
            </label>
          </td>
        </tr>
        <tr>
          <td colspan="2" style="border-right:1px solid #999;">Recevez vos accès immédiatement</td>
          <td colspan="4" style="padding-left:90px;">Accès disponibles après réception du paiement</td>
        </tr>
      </table>

      <br /><br /><br />

      <input id='enregistrer' name='enregistrer' value='Enregistrer la commande' type='button' onclick='verif_sous_paiement();' style='width:300px;height:40px;' />
      <br /><br />
      <br />
    </form>

您的
输入中缺少
type=“text”
属性,甚至浏览器也会将其视为文本,这可能会导致一些问题

<input type="text" id='nb_acces' name='nb_acces' .......... />

您的
输入中缺少
type=“text”
属性,甚至浏览器也会将其视为文本,这可能会导致一些问题

<input type="text" id='nb_acces' name='nb_acces' .......... />

嗯,我看到有人告诉我去查var_dump的消息,这帮助我现在明白了为什么会有这个问题。我不知道为什么这条信息被删除了,因为它帮了我很多。多亏了发布它的人


如果有人有同样的问题,但我知道它来自旧的,可能是坏的服务器配置,使用$nb_acces和$nb_POST['nb_acces']会产生冲突。不要使用相同的名称。仅此而已-。-

我看到有人告诉我检查var_dump,这帮助我现在明白了为什么会出现这个问题。我不知道为什么这条信息被删除了,因为它帮了我很多。多亏了发布它的人


如果有人有同样的问题,但我知道它来自旧的,可能是坏的服务器配置,使用$nb_acces和$nb_POST['nb_acces']会产生冲突。不要使用相同的名称。仅此而已-。-

这是可复制的吗?也就是说,一旦你切换到
print\r($\u POST['nb\u acces'])
它能工作了吗?如果脚本中同时有
print\r
s怎么办?数组中的键在哪里?你能包含更多的代码吗?这是可复制的吗?也就是说,一旦你切换到
print\r($\u POST['nb\u acces'])
它能工作了吗?如果脚本中同时有
print\r
s怎么办?数组中的键在哪里?你能包含更多的代码吗?是的,我只是删除了它以检查它是否可以更改任何内容,但不,它不会更改任何内容。好的,我会添加更多代码。我不太习惯这个替换函数。不过,它在我的浏览器上似乎工作得很好。你想替换什么?我可以帮助您使用正则表达式。我想删除任何非数字字符。因为这是客户将要购买的物品数量。你现在可以看到我的全部代码了。我已经在我的函数上更新了正则表达式。我看不出HTML有任何问题,如果仍然不起作用,问题是在后端。是的,我只是删除了它以检查它是否可以更改任何内容,但不,它什么也不更改。好的,我将添加更多代码。我不太习惯这个替换函数。不过,它在我的浏览器上似乎工作得很好。你想替换什么?我可以帮助您使用正则表达式。我想删除任何非数字字符。因为这是客户将要购买的物品数量。你现在可以看到我的全部代码了。我已经在我的函数上更新了正则表达式。我看HTML没有任何问题,如果仍然不起作用,问题就出在后端。