Step
1:
Start the XAMPP server
Click on the "Start" button next to
"Apache" to start your Apache Web server and also start "MySQL"
Step 2:
Create
Drop.html
<!doctype
html>
<html
lang="en:US">
<head>
<meta
charset="UTF-8">
<title>Get
CheckBox Value</title>
</head>
<body>
<form
method="post" action="dop.php">
Hobbies:</br>
<input
type="checkbox" name="check_list[]"
value="Dancing">Dancing </br>
<input
type="checkbox"
name="check_list[]"value="Singing">Singing</br>
<input
type="checkbox" name="check_list[]"
value="Netsurfing">Netsurfing </br>
<input
type="submit" name="submitbtn" value="Click"/>
</form>
</body>
</html>
Step
3:
Create dop.php
<?php
if(isset($_POST['submitbtn']))
{
if(!empty($_POST['check_list']))
{
$checked =
count($_POST['check_list']);
echo
"You have selected ".$checked." items: <br/>";
foreach($_POST['check_list']
as $select)
{
echo
"<p>".$select ."</p>";
}
}
else
{
echo
"<i>Please Select at least One Option.</i>";
}
}
?>
Step
4 :
Save both the file(Drop.html,dop.php) in htdocs under xampp server
in c:drive.
Step
5:
Open the browser (chrome)
and type it
localhost/ Drop.html
Hobbies:
Dancing
Singing
Netsurfing
Dancing
Singing
Netsurfing
After
clicking on button you can get the following output
You have selected 3
items:
Dancing
Dancing
Singing
Netsurfing
Thanks for the post, I am techno savvy. I believe you hit the nail right on the head. I am highly impressed with your blog. It is very nicely explained. Your article adds best knowledge to our
ReplyDeleteBest Dot Net Training Institute in Chennai
Best Software Testing Training Institute in Chennai With Placement
Java Certification in Chennai
PHP Training Institute in Chennai