Attached you'll see a picture of a mock up I did for the required UI. As you can see I need some type of scrollable box that contains checkboxes.
I've thought of a scrollable div, although I can't find a way to set a border around a div? Second I thought of an IFrame.. But also not too sure if this is my best option.
Does anybody perhaps have an easier/better way of doing this?
Thanks in advance!
CSS:
.container { border:2px solid #ccc; width:300px; height: 100px; overflow-y: scroll; }
HTML:
<div class="container">
<input type="checkbox" /> This is checkbox <br />
<input type="checkbox" /> This is checkbox <br />
<input type="checkbox" /> This is checkbox <br />
<input type="checkbox" /> This is checkbox <br />
<input type="checkbox" /> This is checkbox <br />
<input type="checkbox" /> This is checkbox <br />
<input type="checkbox" /> This is checkbox <br />
<input type="checkbox" /> This is checkbox <br />
<input type="checkbox" /> This is checkbox <br />
<input type="checkbox" /> This is checkbox <br />
</div>
How it looks:
Is this what you are looking for?
<style type="text/css">
select, ul { height: 100px; overflow: auto; width: 100px; border: 1px solid #000; }
ul { list-style-type: none; margin: 0; padding: 0; overflow-x: hidden; }
li { margin: 0; padding: 0; }
label { display: block; color: WindowText; background-color: Window; margin: 0; padding: 0; width: 100%; }
label:hover { background-color: Highlight; color: HighlightText; }
</style>
<ul>
<li><label for="chk1"><input type="checkbox" name="chk1" id="chk1">First</label></li>
<li><label for="chk2"><input type="checkbox" name="chk2" id="chk2">Second</label></li>
<li><label for="chk3"><input type="checkbox" name="chk3" id="chk3">Third</label></li>
<li><label for="chk4"><input type="checkbox" name="chk4" id="chk4">Fourth</label></li>
<li><label for="chk5"><input type="checkbox" name="chk5" id="chk5">Fifth</label></li>
<li><label for="chk6"><input type="checkbox" name="chk6" id="chk6">Sixth</label></li>
<li><label for="chk7"><input type="checkbox" name="chk7" id="chk7">Seventh</label></li>
</ul>
http://krijnhoetmer.nl/stuff/html/select-multiple-checkbox-list/
if u have aray then use this function in PHP
function addOCheckBoxValuesByArray($arr) {
foreach ($arr as $key => $value) {
echo"<input type= 'checkbox' name='formBylist[]' value='$value' />$value<br />";
}
}
below code access data after user press submit button
if(isset($_POST['formBylist']))
{
$selectedDataBylist = $_POST['formBylist'];
if(!isset($selectedDataBylist))
{ // is data not selected
echo "You didn't select data from below checkbox Table";
}
else
{ // data is user selected
$Cnt = count($selectedDataBylist);
for($i=0; $i < $Cnt; $i++)
{
$result =$selectedDataBylist[$i]);
}
}
enter code here
}
to put all check boxes in scroll bar - use CSS
<html lang="en">
<head>
<style>
.container { border:2px solid #ccc; width:400px; height: 500px; overflow-y: scroll; }
</style>
</head>
///
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<div class="container">
addOCheckBoxValuesByArray($chekboxarray);?>
</div>
enter code here