Home  >  Article  >  Backend Development  >  PHP checkbox checkbox value acquisition and checkbox default value output method_PHP tutorial

PHP checkbox checkbox value acquisition and checkbox default value output method_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:38:31916browse

How to get checkbox value in php

Copy code The code is as follows:




How to get the checkbox value in php






checkbox must use array form when reading the value in php, we read it These values ​​are obtained in the form of an array using php post,
Copy code The code is as follows:

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



php gets the checkbox value of the multi-select box


$ area_arr = array();
if($_GET['action']=="submit"){
$area_arr = $_POST['area'];
}
echo "You select The specified area is: ";
foreach ($area_arr as $k=>$v){
echo $v." ";
}
?>

Hebei


Henan



Shanxi


Shandong


Jiangsu


Zhejiang
< ;label>




< ;/p>




php checkbox default selection problem (all exploited This principle)
Copy code The code is as follows:

>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321742.htmlTechArticlephp method to get the checkbox value. Copy the code as follows: html xmlns="http://www. jb51.net/1999/xhtml" head meta http-equiv="Content-Type" content="text/html; charset=gb231...
Statement:
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