Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.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
Arrays 检查值是否已放入数组中_Arrays_Forms_Coldfusion_Struct - Fatal编程技术网

Arrays 检查值是否已放入数组中

Arrays 检查值是否已放入数组中,arrays,forms,coldfusion,struct,Arrays,Forms,Coldfusion,Struct,我有一个单选按钮的表单: <ul> <li><input type="checkbox" name="repeat_period_week_day" value="1" /> Sunday</li> <li><input type="checkbox" name="repeat_period_week_day" value="2" /> Monday</li> <li>&

我有一个单选按钮的表单:

<ul>
     <li><input type="checkbox" name="repeat_period_week_day" value="1" /> Sunday</li>
     <li><input type="checkbox" name="repeat_period_week_day" value="2" /> Monday</li>
     <li><input type="checkbox" name="repeat_period_week_day" value="3" /> Tuesday</li>
     <li><input type="checkbox" name="repeat_period_week_day" value="4" /> Wednesday</li>
     <li><input type="checkbox" name="repeat_period_week_day" value="5" /> Thursday</li>
     <li><input type="checkbox" name="repeat_period_week_day" value="6" /> Friday</li>
     <li><input type="checkbox" name="repeat_period_week_day" value="7" /> Saturday</li>
</ul>

在提交表格时,我想检查哪些收音机是由用户勾选的。是否可以在不循环的情况下进行验证?我的意思是,在CFML中有没有类似于PHP中的in_数组或类似的函数

默认情况下,选中的所有复选框的值将作为逗号分隔的列表提交。因此,如果检查了星期日和星期六并提交了表格,您将得到:

form.repeat_period_week_day= "1,7"
如果您想知道是否选中了“星期六”框,可以使用如下函数:

ListFind(form.repeat_period_week_day,7)

一个真正简单准确的例子。你应该为他提供一些代码。作为旁注。这是重复一次以上的所有URL或表单参数的行为。它们被连接到一个值列表中。