Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.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
Forms 循环通过所有特定表单字段_Forms - Fatal编程技术网

Forms 循环通过所有特定表单字段

Forms 循环通过所有特定表单字段,forms,Forms,我正在制作一个配方表单,其中有许多字段需要配方成分。 例如,我的代码是这样的 <legend><span>Recipe Ingredients</span></legend> <label for="recipe_ing" title="Ingredients Name" class="required">Ingredient:<span>*</span>&

我正在制作一个配方表单,其中有许多字段需要配方成分。 例如,我的代码是这样的

            <legend><span>Recipe Ingredients</span></legend>
                <label for="recipe_ing" title="Ingredients Name" class="required">Ingredient:<span>*</span></label>
                <input name="recipe_ingr" id="recipe_ingr"  size="10" />    &nbsp;  
                Quantity: <input id="recipe_qty" name="recipe_qty" size="5" />  &nbsp; 
                unit: <input id="recipe_unit" name="recipe_unit" size="5" />    &nbsp;
                Notes: <input type="text" id="recipe_notes" name="recipe_notes" size="15" />&nbsp; <br /><br />


                <label for="recipe_ing" title="Ingredients Name" class="required">Ingredient2:<span>*</span></label>
                <input name="recipe_ingr2" id="recipe_ingr"  size="10" />   &nbsp;  
                Quantity: <input id="recipe_qty" name="recipe_qty2" size="5" /> &nbsp; 
                unit: <input id="recipe_unit" name="recipe_unit2" size="5" />   &nbsp;
                Notes: <input type="text" id="recipe_notes" name="recipe_notes2" size="15" />&nbsp; <br /><br />
配方成分
成分:*
数量:
单位:
注:

Ingredient2:* 数量: 单位: 注:

它最多有15种成分、数量、单位和注释

表单数据由formcheck.php处理和控制

现在的问题或我的问题是,formcheck.php中可能的选项/函数是什么?这样,我就不用定义15次if(isset($\u POST[]),而是运行一个循环,它会获取配料、数量、单位和注释的所有相关数据


我希望我能说清楚

如果您在不同的表单字段中漏掉数字会怎么样? 因此,创建15个“配方”字段。在perl中,您得到一个包含所有值的变量


或者在1到15之间做一个for循环?

我可以做任何必要的更改,我可以把它们都做出来。由于我对php了解不多,那么循环遍历所有值的正确循环函数是什么呢?我也不知道php,但也许这可以帮助您: