开发者

Retain the value of while() generated list of checkbox fields. Value="checked" (but value has data already?)

开发者 https://www.devze.com 2023-02-04 23:23 出处:网络
I\'m in a bit of an odd spot here. I am modifying a script, and my validation is all w开发者_运维问答orking fine with the exception of my checkbox input selections which are generated from an array wi

I'm in a bit of an odd spot here. I am modifying a script, and my validation is all w开发者_运维问答orking fine with the exception of my checkbox input selections which are generated from an array with a while loop..

What I need to be able to do is retain the value="checked" if the box has been selected, but the value field currently stores the id value to be passed to a table, and I the value option is how the "checked" is called... So

...PHP_SELF...

while(...)
{
    <input name="seminar[]" type="checkbox" id="seminar[]" value="<?= $data[id] ?>">
}

...SUBMIT...

I am thinking I might need to store the submitted values in an array, then replace the value="<?= $data[id] ?>" with value="checked" but seems kinda wonky to me..

Anyone run into this before have an suggestions?


I solved this. I did not realize this, but there is an input value titled: checked which works like: checked="checked" .. Geeze this put me in my place : )

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号