Get Value from multiple checkbox in PHP

<h3>Get Value from multiple checkbox in PHP</h3>
<form action="test.php" method="post">
<input type="checkbox" name="fruit_list[]" value="1">Apple&nbsp;
<input type="checkbox" name="fruit_list[]" value="2">Banana&nbsp;
<input type="checkbox" name="fruit_list[]" value="3">Mango
<input type="checkbox" name="fruit_list[]" value="4">Guava</br></br>
<input type="checkbox" name="fruit_list[]" value="5">Orange</br></br>
<input type="submit" value="Save" />
$fruit_list = array();
foreach($_POST['fruit_list'] as $val)
$fruit_list[] = (int) $val;
$fruit_list = implode(',', $fruit_list);
echo "Fruits Value are :- ".''.$fruit_list;

checkbox in php







When we check first three checkbox then click on save button then we get three values. Like as following image

checkbox in php

Categories: PHP & Joomla | Tags: , , , , , , | 1 Comment

Post navigation

One thought on “Get Value from multiple checkbox in PHP

  1. raga

    II have to store all the values of the checkboxes selected in a variable how should i do it?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: