Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有很多输入字段,我需要确定第一个空输入字段。目前我正在单独检查每一个,如果它不是空的,则转到下一个。但我想知道是否有人知道这样做的更有效方法:
if(empty($a)){$a=$name;}else if(empty($b)){$b=$name;}else if(empty($c)){$c=$name;}else ............if(empty($z)){$z=$name;}else {$message="all boxes are filled"};
好吧,假设您正在使用POST或GET在表单上,您可以像这样遍历每个表单元素:
POST
GET
foreach ($_GET as $key => $value) { }