PHP array conversion string and check box how to tick

Source: Internet
Author: User
Tags explode

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.