简体   繁体   中英

finding the first empty input box

I have many input fields and I need to ascertain the first empty input field. at the moment I'm checking each one individually and if its not empty move on to the next one. But I was wondering if anyone knew of a more efficient way of doing this:

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"}; 

好吧,假设您在表单上使用POSTGET ,则可以像这样循环遍历每个表单元素:

foreach ($_GET as $key => $value) { }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM