infolink

Wednesday, 25 February 2015

PHP Multiple Checkbox Array

This example shows how the programmer can use multiple checkbox array and display the values of selected checkboxes.

Multiple Checkbox Array
Multiple Checkbox Array

PHP Code:

<form method='post' id='form1' action='CheckboxArray.php?process'> 
<table> 
<tr>
    <td>Checkbox Array Example. Select from below</td>
</tr>
<tr>
    <td>
    <input type='checkbox' name='checkboxarray[]' value='checkbox 1'>checkbox 1<br>
    <input type='checkbox' name='checkboxarray[]' value='checkbox 2'>checkbox 2<br>
    <input type='checkbox' name='checkboxarray[]' value='checkbox 3'>checkbox 3
    </td> 
</tr> 
</table> 
<input type='submit' id="submit" value="Click"> 
</form>

<?php 
if (isset($_GET['process'])) 
{
echo "you Selected: ";
foreach($_POST['checkboxarray'] as $value)
{
echo $value."\t"; 
}
}
?>


Note:

Copy and paste this code and save the file with the name of "CheckboxArray.php" and enjoyed.

OUTPUT


Multiple Checkbox Array
Multiple Checkbox Array

7 comments:


  1. I am newbie of this PHP technology, this post helps me to know the introductory of PHP, Thanks for posting such a nice post.
    Regards,
    PHP Training in Chennai|PHP Course in Chennai

    ReplyDelete
  2. Thanks for sharing informative article on web design and development. As every business is moving towards online marketing, there is huge demand for trained and skilled web designers and developers. Web designing Training in Chennai

    ReplyDelete
  3. Nice post.Thank you so much for sharing your valuable information about PHP.I have learned much.Iam a begginer of PHP. Have a look on custom software development company,if you want any software solutions.we bring to you the BEST solutions at nominal rates.

    ReplyDelete
  4. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
    amazon-web-services-training-in-bangalore

    Best Hadoop Training Institute In chennai

    ReplyDelete
  5. I wish to show thanks to you just for bailing me out of this particular trouble.As a result of checking through the net and meeting techniques that were not productive, I thought my life was done.
    java training in chennai

    ReplyDelete
  6. this is really too useful and have more ideas and keep sharing many techniques. eagerly waiting for your new blog and useful
    information. keep doing more.Send a message.

    pacetechnosoft
    Education

    ReplyDelete