Hi Larry I am create first php page for UI . Second page create where I write SQL Query and Through Ajax call Second page in first page . Now i am doing one project where in UI have Three div and each div have 20 checkbox which is coming by Second Page where we call data through sql query in loop so 20 time data retreive and print in all Three div . Now main thing is all three div have 20 check box for same employee name . Now condition is if first div user select any employee name checkbox then same name of checkbox disable in other two div check box . so same name not repeat this is aim . I am trying to put different id for all three <input id=" "> but its not work . In Sr.no 3 where is use input = " checkbox" rest becaause we need multiple employee selection in one div anther two div show input="radio" because we want to select only one name .Now i want in one div where input ="checkbox" where i select 2 employee name then same name disable another two div but one input is check box and another two div input ="radio" and each div have different id so how can do with radio and checkbox . for why i So could you help me is their possible to put Input id Diiffernt or same .Below my code
1. UI Page where we print All three Sepreate div with 20 checkbox.
<div class="col-sm-4">
<div class="form-group ui-widget" id="reviewerdiv"> ////<- this id retrieve data from Second page while using Ajax
</div>
</div>
<div class="col-sm-4">
<div class="form-group ui-widget" id="primarydiv">////<- this id retrieve data from Second page while using Ajax
</div>
</div>
<div class="col-sm-4">
<div class="form-group ui-widget" id="secondarydiv">////<- this id retrieve data from Second page while using Ajax
</div>
</div>
2. Ajax code:
function getSecondary() {
var ajaxRequest; // The variable that makes Ajax possible!
try {
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
}catch (e) {
// Internet Explorer Browsers
try {
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e) {
try {
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
}catch (e) {
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data
// sent from the server and will update
// div section in the same page.
ajaxRequest.onreadystatechange = function() {
if(ajaxRequest.readyState == 4) {
var ajaxDisplay = document.getElementById('secondarydiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
RequiredSecondry();
}
}
// Now get the value from user and pass it to
// server script.
ajaxRequest.open("GET", "PopulateEmployee.php?name=<?php echo $name; ?>&secondaryname=true", true);
ajaxRequest.send(null);
}
////////for Primary
function getPrimary() {
var ajaxRequest; // The variable that makes Ajax possible!
try {
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
}catch (e) {
// Internet Explorer Browsers
try {
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e) {
try {
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
}catch (e) {
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data
// sent from the server and will update
// div section in the same page.
ajaxRequest.onreadystatechange = function() {
if(ajaxRequest.readyState == 4) {
var ajaxDisplay = document.getElementById('primarydiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
RequiredPrimary();
}
}
// Now get the value from user and pass it to
// server script.
ajaxRequest.open("GET", "PopulateEmployee.php?name=<?php echo $name; ?>&primaryname=true", true);
ajaxRequest.send(null);
}
/////// for reviewer
function getReviewer() {
var ajaxRequest; // The variable that makes Ajax possible!
try {
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
}catch (e) {
// Internet Explorer Browsers
try {
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
}catch (e) {
try {
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
}catch (e) {
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data
// sent from the server and will update
// div section in the same page.
ajaxRequest.onreadystatechange = function() {
if(ajaxRequest.readyState == 4) {
var ajaxDisplay = document.getElementById('reviewerdiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
RequiredReviewer();
}
}
// Now get the value from user and pass it to
// server script.
ajaxRequest.open("GET", "PopulateEmployee.php?name=<?php echo $name; ?>&reviewername=true", true);
ajaxRequest.send(null);
}
3. Second page where i write sql query with inside print of retrieve
<?php
$sql = "SELECT * FROM employee WHERE email NOT IN (SELECT boss.email FROM boss) AND email NOT IN (SELECT deactivatedemployee.employee FROM deactivatedemployee)";
$resultset = $connection->query($sql);
if(!$resultset) {
die('Could not get data: ' . $connection->error);
} else {
if(isset($_GET['secondaryname'])) {
echo "<label class=\"label6\" for=\"tasksecondary\">Secondary Responsible:</label>";
//echo "<select class=\"form-control form-theme\" multiple=\"multiple\" name=\"tasksecondary[]\ id=\"tasksecondary\" required>";
echo "<div class=\"form-theme form-scroll\" id=\"secondryPerson\" style=\"height: 88px;width: 100%;overflow: auto;padding: 0px 20px;\">";
echo "<input id=\"searchsecond\" class=\"searchtheme\"; type=\"text\" placeholder=\"Search...\" autocomplete=\"off\">";
while ($row = $resultset->fetch_array(MYSQLI_ASSOC)) {
//echo "<option value=\"{$row['email']}\">{$row['name']}</option>";
echo "<div><input type=\"checkbox\" name=\"tasksecondary[]\ id=\"tasksecondary\" value=\"{$row['email']}\" >";
echo "<span>".$row['name']."</span>"."</div>";
}
echo "</div>";
} else if(isset($_GET['primaryname'])){
echo "<label class=\"label6\" for=\"taskprimary\">Primary Responsible:</label>";
//echo "<select class=\"form-control form-theme\" multiple=\"multiple\" name=\"tasksecondary[]\ id=\"tasksecondary\" required>";
echo "<div class=\"form-theme form-scroll\" id=\"primaryPerson\" style=\"height: 88px;width: 100%;overflow: auto;padding: 0px 20px;\">";
echo "<input id=\"searchprimary\" class=\"searchtheme\"; type=\"text\" placeholder=\"Search...\" autocomplete=\"off\">";
while ($row = $resultset->fetch_array(MYSQLI_ASSOC)) {
//echo "<option value=\"{$row['email']}\">{$row['name']}</option>";
//echo "<div ><input type=\"radio\" name=\"taskprimary[]\ id=\"taskprimary\" value=\"{$row['email']}\" >";
echo "<div ><input type=\"radio\" name=\"taskprimary[]\ id=\"taskprimary\" value=\"{$row['email']}\" >";
echo"<span>".$row['name']."</span>"."</div>";
}
echo "</div>";
}else if(isset($_GET['reviewername'])){
echo "<label class=\"label6\" for=\"taskreviewer\">Reviewer Responsible:</label>";
//echo "<select class=\"form-control form-theme\" multiple=\"multiple\" name=\"tasksecondary[]\ id=\"tasksecondary\" required>";
echo "<div class=\"form-theme form-scroll\" id=\"reviewerPerson\" style=\"height: 88px;width: 100%;overflow: auto;padding: 0px 20px;\">";
echo "<input id=\"searchreviewer\" class=\"searchtheme\"; type=\"text\" placeholder=\"Search...\" autocomplete=\"off\" >";
while ($row = $resultset->fetch_array(MYSQLI_ASSOC)) {
//echo "<option value=\"{$row['email']}\">{$row['name']}</option>";
//echo "<div><input type=\"radio\" name=\"taskreviewer[]\ id=\"taskreviewer\" value=\"{$row['email']}\" >";
echo "<div><input type=\"radio\" name=\"taskreviewer[]\ id=\"taskreviewer\" value=\"{$row['email']}\" >";
echo"<span>".$row['name']."</span>"."</div>";
}
echo "</div>";
}
}
?>