PHP array convert string and check box checked, apply to function implode explode
check box is selected after how to save the data, the form submitted to an array, to convert the string used to function implode
if (!empty ($_post[' Yuyan ')) {
$bbyuyan =implode (",", $_post[' Yuyan '));
}
if (!empty ($_post[' Fenge ')) {
$bbfenge =implode (",", $_post[' Fenge '));
}
if (!empty ($_post[' Biaoqian ')) {
$bbbiaoqian =implode (",", $_post[' Biaoqian '));
}
check box shows how to use the string conversion array to function explode
if (!empty ($users [' Yuyan '])) {
$users [' Yuyan ']=explode (",", $users [' Yuyan ']);
}
if (!empty ($users [' Fenge '])) {
$users [' Fenge ']=explode (",", $users [' Fenge ']);
}
if (!empty ($users [' Biaoqian '])) {
$users [' Biaoqian ']=explode (",", $users [' Biaoqian ']);
}
How the check box is displayed, the following instance
<input name= "biaoqian[" value= "type=" checkbox "{#foreach item=biaoqian1 from= $users. biaoqian#}{#if $ BIAOQIAN1 eq "Night Recordable" #} checked= "checked" {#/if#}{#/foreach#}/> evening recordable
<input name= "biaoqian[" "value=" Saturday recordable "type=" checkbox "{#foreach item=biaoqian1 from= $users. biaoqian#}{#if $ BIAOQIAN1 eq "Saturday recordable" #} checked= "checked" {#/if#}{#/foreach#}/> Saturday recordable
<input name= "biaoqian[" "value=" Sunday recordable "type=" checkbox "{#foreach item=biaoqian1 from= $users. biaoqian#}{#if $ BIAOQIAN1 eq "Sunday recordable" #} checked= "checked" {#/if#}{#/foreach#}/> Sunday recordable
<input name= "biaoqian[" "value=" low record price type= "checkbox" {#foreach item=biaoqian1 from= $users. biaoqian#}{#if $ BIAOQIAN1 eq "Low Record Price" #} checked= "checked" {#/if#}{#/foreach#}/> low price
check box is more complicated than the radio box, and the Radio box is the same as the normal form.
Article reprint (JIU le network 96net.com.cn)
PHP array conversion string and check box how to tick