Home > Backend Development > PHP Tutorial > Example of getting the value in the checkbox in php

Example of getting the value in the checkbox in php

WBOY
Release: 2016-07-25 09:13:00
Original
1080 people have browsed it

There are checkboxes as follows:

  1. table tennis
  2. Computer
  3. Singing
Copy the code

Example 1, get the value of the check box.

  1. $loves=$_post['loves']; //Get the array;
  2. $loves=implode(",", $loves); //Convert the array into a string;
Copy code

Example 2, get the value of the check box.

  1. if(!empty($_post['loves'])){ //!empty($_post['loves'])
  2. $loves=$_post['loves'];
  3. echo(' Your selection result is:');
  4. for($i=0; $i
  5. echo($_post['loves'][$i]. ' ');
  6. }
  7. print_r($loves);
  8. $pid = implode(",",$loves);
  9. }
Copy code


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template