Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize php to delete multiple selection content of foreground checkbox at one time

Shulou Source: shulou.com Published: 2022-06-03 07:36:07 09月19日 Update

This article mainly introduces "how to achieve php one-time deletion of foreground checkbox multi-selected content". In daily operation, I believe that many people have doubts about how to achieve php to delete foreground checkbox multi-selected content at one time. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for everyone to answer "how to php delete foreground checkbox multi-selected content at one time". Next, please follow the editor to study!

The copy code is as follows:

SQL:$SQL= "delete from `doing` where id in ('1Jing 2Jing 3Jing 4')"

The data are separated by commas.

Form:

The copy code is as follows:

Good $ID_Dele=$_POST ['ID_Dele'] will be an array. Although PHP is weakly typed, it is not as weak as ASP.

ASP can directly:

SQL= "delete from [doing] where id in ('" & ID_Dele& ")" to delete. But PHP can't put $ID_Dele directly into it. Because $ID_Dele is not'1 ID_Dele 2 ~ 3 ~ 4'Oh, because $1 is an array with keys and values.

Well, it's not difficult in PHP. There happens to be a function: implode (), by the way. A function that is the opposite of split ()\ explode (), the latter two are separated by a character (such as a comma), while the former can be concatenated into strings.

Therefore:

The copy code is as follows:

$ID_Dele= implode (",", $_ POST ['ID_Dele'])

$SQL= "delete from `doing` where id in ($ID_Dele)"

At this point, on the "how to achieve php one-time deletion of the foreground checkbox multi-selected content" study is over, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Code one-time content foreground learning function character array more comma help practical yes yes next function string data article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Xiaomi Microsoft vpn Shulou Information