A simple way to get check box values in PHP _php tips

Source: Internet
Author: User

The example in this article describes a simple way to get a check box value from PHP. Share to everyone for your reference, specific as follows:

Html:

<form id= "Form1" Name= "Form1" method= "Post" action= "checkbox.php" >
<input type=checkbox name=checkbox[] Value= "1" >
<input type=checkbox name=checkbox[] value= "2" >
<input type=checkbox name=checkbox[] Value= "3" >
<input type=checkbox name=checkbox[] value= "4" >
<input type=checkbox name=checkbox[] Value= "5" >
<input type= "Submit" name= "button" id= "checkbox" value= "Submit"/>
</form>

Php:

<?php
$text 1=$_post[' checkbox '];
For ($i =0 $i <count ($text 1); $i + +)
{
$yourwant = $text 1[$i]; 
echo $yourwant. " <br/> ";
}
? >

More about PHP Interested readers can view the site topics: "PHP Socket Usage Summary", "PHP Network Programming Skills Summary", "Php Curl Usage Summary", "PHP Array" operation Skills Encyclopedia, "PHP Data structure and algorithm tutorial", " PHP Mathematical Arithmetic skills Summary, "PHP Date and Time usage summary", "PHP object-oriented Programming Introduction Course", "PHP string (String) Usage Summary", "Php+mysql Database operation Introduction Tutorial" and "PHP common database Operation skill Summary"

I hope this article will help you with the PHP program design.

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.