Php 如果输入数据,则使用join()函数

Php 如果输入数据,则使用join()函数,php,forms,Php,Forms,我有一个jQuery移动表单,其中的数据发布到review.php表单。当在复选框数组中没有输入任何数据时(不需要用户提供任何数据),审查将返回 警告:join()[function.join]:在第35行的/hermes/waloraweb076/b2830/moo.revolveis/hg/order/review.php中传递的参数无效 以下是表格的示例: <li data-role="fieldcontain"> <field

我有一个jQuery移动表单,其中的数据发布到review.php表单。当在复选框数组中没有输入任何数据时(不需要用户提供任何数据),审查将返回

警告:join()[function.join]:在第35行的/hermes/waloraweb076/b2830/moo.revolveis/hg/order/review.php中传递的参数无效

以下是表格的示例:

<li data-role="fieldcontain">
                      <fieldset data-role="controlgroup">
                          <legend>Choose Grind:</legend>
                          <input type="checkbox" name="grind51[vgrind]" id="vgrind" class="custom" value="V-Grind">
                          <label for="vgrind">V-Grind</label>
                          <input type="checkbox" name="grind51[tourgrind]" id="tourgrind" class="custom" value="Tour-Grind">
                          <label for="tourgrind">Tour Grind</label>
                          <input type="checkbox" name="grind51[healgrind]" id="healgrind" class="custom" value="Heal-Grind">
                          <label for="healgrind">Heal Grind</label>
                          <input type="checkbox" name="grind51[nogrind]" id="nogrind" class="custom" value="No Grind">
                          <label for="nogrind">No Grind</label>
                      </fieldset>
</li>

在我的代码中

您的PHP看起来不错,我要更改的HTML:将元素名称设置为just
name[]
以填充常规(非关联)数组


在尝试加入
之前,只需检查是否设置了
$\u请求['grind51']
。该错误是由于空返回不是数组(并且无法加入)这一事实造成的。

如何检查它是否已设置?我对PHP还是相当基础的。顺便说一下,谢谢。
<?php

    $grind51 = join(", ", $_REQUEST["grind51"]);
     echo (!empty($_REQUEST['grind51'])) ? "<div class='reviewItem'><span class='reviewTitle'>51 Grind:</span>{$grind51}</div>" : "";

?>
$grind51 = join(", ", $_REQUEST["grind51"]);
<li data-role="fieldcontain">
                      <fieldset data-role="controlgroup">
                          <legend>Choose Grind:</legend>
                          <input type="checkbox" name="grind51[]" id="vgrind" class="custom" value="V-Grind">
                          <label for="vgrind">V-Grind</label>
                          <input type="checkbox" name="grind51[]" id="tourgrind" class="custom" value="Tour-Grind">
                          <label for="tourgrind">Tour Grind</label>
                          <input type="checkbox" name="grind51[]" id="healgrind" class="custom" value="Heal-Grind">
                          <label for="healgrind">Heal Grind</label>
                          <input type="checkbox" name="grind51[]" id="nogrind" class="custom" value="No Grind">
                          <label for="nogrind">No Grind</label>
                      </fieldset>
</li>
if ( isset( $_REQUEST['grind51'] ) && is_array( $_REQUEST['grind51'] ) ) { 
     $grind51 = join(", ", $_REQUEST["grind51"]);
}