checkbox.php
<body>
<form>
<label>
<input type="checkbox" value="1" name="name">fruits</label>
<label>
<input type="checkbox" value="2" name="name">vegitables</label>
</form>
<!--modal-->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-default" id="submit" onclick="submit();">save</button>
<h4 id="result"></h4>
</div>
</div>
</div>
</div>
</body>
Above is my main two checkboxes. A modal appears when I click on a checkbox. On which displays dynamic checkboxes(sub checkboxes) from database. when I click on sub checkboxes on modal and then click submit. Alert pops with no values. what I need to do is to get checked checkboxes values into alert. can anyone help me?
Here are my checkbox.js
$(document).ready(function(){
$("input[type=checkbox][name=name]").change(function(){
if(this.checked) {
var value = $(this).val();
$.ajax({
url:"modal.php",
type:"POST",
data:{value:value},
success:function(modalBody){
$("#myModal .modal-body").html(modalBody);
$("#myModal").modal('show');
}
});
}
});
});
function submit() {
var values = [];
$('input[type=checkbox][name=sub]').each(function(){
if($(this).is(":checked"))
{
values.push($(this).val());
alert(values.join());
}
});
}
and modal.php
<html>
<body>
<?php
if($_POST['value']){
$test = $_POST['value'];
include("config.php");
$sql = "SELECT name FROM tb where Id=".$value." ";
$res = mysqli_query($conn,$sql);
while($row = mysqli_fetch_assoc($res)){
?>
<input id='category' type='checkbox' name=sub'[]' value = <?php echo $row['name']; ?> /><?php
echo $row['name'];
echo "<br>";
}
}
else echo "not post";
?>
</body>
</html>
config.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
$db = "test";
// Create connection
$conn = mysqli_connect($servername, $username, $password,$db);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully <br/>";
?>
Fix your php page
<?php
if($_POST['value']){
$test = $_POST['value'];
include("config.php");
$sql = "SELECT name FROM tb where Id=".$value." ";
$res = mysqli_query($conn,$sql);
while($row = mysqli_fetch_assoc($res)){
echo "<input class='category' type='checkbox' name='sub[]' value ='".$row['name'];."'/>";
echo $row['name'];
echo "<br>";
}
}
else echo "not post";
?>
your js
var values = [];
$('.category:checked').each(function(){
values.push($(this).val());
});
alert(values.join());
Related
the body
(many pieces of code were taken from a guide on youtube where everything worked, i
I did everything in the same way but it doesn't work).
the removeClass works only when i refresh the page
<body>
<div class="container">
<div class="todo">
<h1>todo app with php</h1>
<h3>add a new to do</h3>
<form action="index.php" method="POST">
<div class="form-group">
<input type="text" class="form-control" name="todo" placeholder="todo name">
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="add a new todo task list">
</div>
</form>
<?php while ($row = mysqli_fetch_array($result)) { ?>
<div class="todo-item">
<?php if ($row['checkbox']) { ?>
<input type="checkbox" class="check-box" data-todo-id="<?php echo $row['id']; ?>" checked />
<h2 class="checked"><?php echo $row['t_name'] ?></h2>
<?php } else { ?>
<input type="checkbox" data-todo-id="<?php echo $row['id']; ?>" class="check-box" />
<h2><?php echo $row['t_name'] ?></h2>
<?php } ?>
<small>created: <?php echo $row['t_date'] ?></small>
<!--<button>delete</button> -->
</div>
<?php } ?>
</div>
</div>
in the script maybe I should enter something like e.stopPropagation() but i dont understand where and how. the addClass works but i can't turn back removing checked class.
<script>
$(document).ready(function() {
// checkbox toggle function
$(".check-box").on('click', function(e) {
//Get Task id from Task Table using checkbox
const id = $(this).attr('data-todo-id');
$.post('check.php', {
id: id
},
(data) => {
if (data != 'error') {
const h2 = $(this).next();
if (data === '1') {
h2.removeClass('checked');
// If Data Response id 1 means if checkbox is checked this alert will be show
} else {
h2.addClass('checked');
// If Data Response id 0 means if checkbox is unchecked this alert will be show
}
}
}
);
});
});
</script>
the check.php where i have data
<?php
if (isset($_POST['id'])) {
require 'db.inc.php';
// Get Id From Post Method
$id = $_POST['id'];
if (empty($id)) {
echo 'error';
} else {
// Select Task From Info table
$record = mysqli_query($connection, "SELECT * FROM todo WHERE id=$id");
$todo = mysqli_fetch_array($record);
$uId = $todo['id'];
$checked = $todo['checkbox'];
$uChecked = $checked ? 0 : 1;
//Update Task Completed Status
$res = mysqli_query($connection, "UPDATE todo SET checkbox=$uChecked WHERE id=$uId");
if ($res) {
echo $checked;
} else {
echo "error";
}
$connection = null;
exit();
}
} else {
header("Location: ../index.php?mess=error");
}
Hi i have a registration form in my website.if the particular field in the db is null then the form should not be displayed to the user.Here if the payment_category_upload field is empty then the form should not displayed to the user otherwise the form should be displayed.
<?php include 'includes/db.php';
$sql = "SELECT * FROM users WHERE username = '$_SESSION[user]' AND user_password = '$_SESSION[password]' AND payment_category_upload!='' ";
$oppointArr =array();
$result = mysqli_query($conn,$sql);
if (mysqli_num_rows($result) > 0)
{
if(isset($_POST['submit_user'])|| isset($_POST['save_users']))
{
$formsubmitstatus = isset($_POST['submit_user'])?1:0;
if($_FILES["affidavits_upload"]["tmp_name"]!="")
{
$pname = rand(1000,10000)."-".str_replace("-"," ",$_FILES["affidavits_upload"]["name"]);
$affidavits_upload = $_FILES["affidavits_upload"]["tmp_name"];
$uploads_dir = '../admin/images/uploads';
move_uploaded_file($affidavits_upload, $uploads_dir.'/'.$pname);
}
else
{
$pname = $_POST['hid_affidavits_upload'];
}
$id= $_POST['users_id'];
$ins_sql = "UPDATE users set affidavits_upload='$pname',status='3',affidavitsupload_submit_status='$formsubmitstatus' WHERE users_id = $id";
$run_sql = mysqli_query($conn,$ins_sql);
$msg = 'Your Application successfully submitted. ';
$msgclass = 'bg-success';
}
else
{
$msg = 'Record Not Updated';
$msgclass = 'bg-danger';
}
}
else
{
echo "Please make the payment to enable Affidavits";
}
?>
FORM :
<form class="form-horizontal" action="affidavits.php" method="post" role="form" enctype="multipart/form-data" id="employeeeditform">
<?php if(isset($msg)) {?>
<div class="<?php echo $msgclass; ?>" id="mydiv" style="padding:5px;"><?php echo $msg; ?></div>
<?php } ?>
<input type='hidden' value='<?=$id;?>' name='users_id'>
<div class="form-group">
<label for="affidavits_upload" class="col-sm-4 control-label">Affidavits Upload</label>
<div class="col-sm-8">
<input type="hidden" value="<?php echo $oppointArr['affidavits_upload'];?>" name="hid_payment_category_upload">
<input type="file" name="affidavits_upload" id="affidavits_upload">
<?php if(!empty($oppointArr['affidavits_upload'])){?>
<div>
<?php echo $oppointArr['affidavits_upload'];?>
</div>
<?php }?>
<span class="text" style="color:red;">Please upload PDF Format Only</span>
</div>
</div>
<div class="col-sm-offset-2">
<?php if($oppointArr['affidavitsupload_submit_status'] == 0){ ?>
<button type="submit" class="btn btn-default" name="save_users" id="save_users">Save</button>
<button type="submit" class="btn btn-default" name="submit_user" id="subject">Submit Application</button>
<?php } ?>
</div>
</form>
//Add this Css class
.hiddenBlock {
display:none
}
<div class="<?php echo isset(test_field)?"":"hiddenBlock"; ?>">
<form>...<form>
</div>
You can do it like this for your field.
I have a checkbox list. When I click on a checkbox, a modal appears with corresponding data coming from database. I have already done this. here are my codes.
db.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
$db = "db";
$conn = mysqli_connect($servername, $username, $password,$db);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully <br/>";
?>
student.php
<body>
<form>
<label>
<input type="checkbox" value="1" name="name">
Ann
</label>
<label>
<input type="checkbox" value="2" name="name">
Sam
</label>
<label>
<input type="checkbox" value="3" name="name">
Amaa
</label>
</form>
<!--modal-->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="submit" class="btn btn-default" id="submit" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</body>
student.js
$(document).ready(function(){
$("input[type=checkbox][name=name]").change(function(){
if(this.checked) {
var value = $(this).val();
$.ajax({
url:"modal.php",
type:"POST",
data:{value:value},
success:function(modalBody){
$("#myModal .modal-body").html(modalBody);
$("#myModal").modal('show');
}
});
}
});
});
modal.php
<?php
if($_POST['value']){
$test = $_POST['value'];
include('db.php');
$sql = "SELECT subject FROM grade where name=".$value." ";
$res = mysqli_query($conn,$sql);
while($row = mysqli_fetch_assoc($res)){
echo "<input type='checkbox' name='subject[]' value='".$row['subject']."'>".$row['subject'];
echo "<br>";
}
}
?>
My problem is how to send selected checkbox values on the modal into the database?
Here are the way I tried.
new.js
$(document).ready(function(){
$("input[type=checkbox][name=name]").change(function(){
if(this.checked) {
var value = $(this).val();
$.ajax({
url:"modal.php",
type:"POST",
data:{test:value},
success:function(modalBody){
$("#myModal .modal-body").html(modalBody);
$("#myModal").modal('show');
}
});
}
});
$('#myModal submit').on('submit',function(){
var insert = [];
$('input[name=category[]]').each(function(){
if($(this).is(":checked")) {
insert.push($(this).val());
}
});
insert = insert.toString();
$.ajax({
url: "insert.php",
method: "POST",
data:{insert:insert},
success:function(data){
$('#result').html(data);
}
});
});
});
insert.php
<?php
if(isset($_POST["insert"])) {
include ('db.php');
$query = "INSERT INTO name_list(student_name) VALUES ('".$_POST["insert"]."')";
$result= mysqli_query($conn, $query);
echo "Data Inserted Successfully!";
}
?>
I tried a lot. Everytime name_list table fills with no values. can you help me to solve this?Again I want send selected checkbox values on the modal into database. Below values.
echo "<input type='checkbox' name='subject[]' value='".$row['subject']."'>"
First of all if there are more than one checkbox with the same name than the name must be an array like:
<form>
<input type="checkbox" name="bla[]" value="1" />
<input type="checkbox" name="bla[]" value="2" />
</form>
Now you can get there value in jquery like:
$(document).ready( function () {
$("input[name='bla[]']").each( function () {
if($(this).is(':checked'))
{
alert($(this).val());
// put this value in an array
}
});
});
Working Fiddle
Now this one seems a little complicated and maybe I have got myself into more than I can manage but it seems the only way I can achieve what I need.
I am a complete novice and am going at this blindly for a project I'm working on (this is the most complicated thing in the whole project) so any help would be much appreciated!
I basically have a bootstrap webpage, this webpage displays a users list (from php in a while loop). What I need the user to be able to do is select a user from this and edit the details in a form in a bootstrap modal.
So far I have everything working, modal loading etc and from various sources online have wrangled JSon but I've never learnt it and am way out of my depths. Currently it is printing '[object HTMLCollection]' in each field.
Firstly here is the HTML for the modal & list:
Modal (This comes up perfectly)
<div class="modal fade" id="editUserModal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h2 class="modal-title" id="editModalLabel"></h2>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="username" class="control-label">Username:</label>
<input type="text" name="username" class="form-control" id="username"></input>
</div>
<div class="row">
<div class="col-lg-12">
<div class="form-group">
<label for="password" class="control-label">Password:</label>
<div class="input-group">
<span class="input-group-btn">
<input type="button" class="form-control" value="Change Password" onClick="changeRandomPassword();">
</span>
<input type="text" name="password" class="form-control" id="password" value="" required></input>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="firstName" class="control-label">First Name:</label>
<input type="text" name="firstName" class="form-control" id="firstName">
</div>
<div class="form-group">
<label for="lastName" class="control-label">Surname:</label>
<input type="text" name="lastName" class="form-control" id="lastName">
</div>
<div class="form-group">
<label for="jobTitle" class="control-label">Job Title:</label>
<input type="text" name="jobTitle" class="form-control" id="jobTitle">
</div>
<div class="form-group">
<label for="TaskTeam" class="control-label">Task Team:</label>
<input type="text" name="TaskTeam" class="form-control" id="TaskTeam">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-success">Submit Changes</button>
</div>
</div>
</div>
</div>
Here is the php list: (again no trouble here)
<?php
include("dbconnect.php");
$dbQuery= mysql_query("SELECT * FROM users ORDER BY lastName ASC;");
while($dbRow = mysql_fetch_array($dbQuery))
{
$userID = $dbRow['id'];
$username = $dbRow['username'];
$firstName = $dbRow['firstName'];
$lastName = $dbRow['lastName'];
$jobTitle = $dbRow['jobTitle'];
$userteam = $dbRow['TaskTeam'];
$admin = $dbRow['admin'];
echo '<tr>';
echo '<td>';
echo '<button type="button" class="btn btn-primary close" data-toggle="modal" data-target="#editUserModal" value='.$userID.' id="user" name="user"" data-user='.$userID.'><span title="Edit" aria-hidden="true" class="glyphicon glyphicon-edit"></span></button>';
echo '</td>';
echo '<td>'.$firstName.'</td>';
echo '<td>'.$lastName.'</td>';
echo '<td>'.$jobTitle.'</td>';
echo '<td>'.$userteam.'</td>';
echo '<td>'.$admin.'</td>';
echo '<td>';
echo '<a href="deleteUser.php?id='.$userID.'">';
echo '<button type="button" name="delete_row" id="delete_row" class="close">';
echo '<span title="Delete" aria-hidden="true" class="glyphicon glyphicon-trash">';
echo '</span>';
echo '<span class="sr-only">';
echo 'Delete';
echo '</span>';
echo '</button>';
echo '</a>';
echo '</td>';
echo '</tr>';
}
echo mysql_error();
mysql_close();
?>
Here is where the problem must lay:
<script>
$('#editUserModal').on('show.bs.modal', function (event)
{
var button = $(event.relatedTarget)
var recipient = button.data('user')
var modal = $(this)
modal.find('.modal-title').text('Edit ' + recipient + "'s details.")
$(function ()
{
$.ajax(
{
type: 'GET',
url: "getUser.php?id=",
data: 'recipient',
dataType: "json",
success: function(data)
{
var obj = JSON.parse(data);
$.each(obj, function(key, val)
{
console.log(val);
var id = data[0];
var firstName = data[1];
var lastName = data[2];
var username = data[3];
var password = data[4];
var jobTitle = data[5];
var TaskTeam = data[6];
var admin = data[12];
});
}
})
})
modal.find('.modal-body #firstName').val(firstName)
modal.find('.modal-body #lastName').val(lastName)
modal.find('.modal-body #username').val(username)
modal.find('.modal-body #password').val(password)
modal.find('.modal-body #jobTitle').val(jobTitle)
modal.find('.modal-body #TaskTeam').val(TaskTeam)
})
</script>
Lastly here is php file to get the user details: (This works too but only is done manually- This is the bulk of it excluding passwords etc)
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$userid = intval($_GET['id']);
$sql="SELECT * FROM users WHERE id = $userid";
$result = $conn->query($sql);
/*
$user = array();
while ($row = mysql_fetch_array($result)) {
$details = array(
"username" => $row['username'],
"firstName" => $row['firstName'],
"lastName" => $row['lastName'],
"taskTeam" => $row['taskTeam']
);
$user[] = $details;
}
echo json_encode($user);
$conn->close();
*/
if ($result->num_rows > 0) {
// output data of each row
$array = array();
while($row = $result->fetch_assoc()) {
array_push($array, $row);
}
echo json_encode($array);
} else {
echo "0 results";
}
$conn->close();
Sorry for lack of Mysqli I know this is the latest standard and am currently implementing it in this project.
Any help would be great! Thanks
The problem with your code is here:
var obj = JSON.parse(data);
$.each(obj, function(key, val)
{
console.log(val);
var id = data[0];
var firstName = data[1];
var lastName = data[2];
var username = data[3];
var password = data[4];
var jobTitle = data[5];
var TaskTeam = data[6];
var admin = data[12];
});
You've already told your AJAX call that you are expecting JSON back from your PHP script. You did this with dataType: "json". So there is no reason to do this here: var obj = JSON.parse(data);. Since you told your AJAX call you are going to receive JSON back, it automatically parses it for you when the PHP script completes.
To access the data simply use the . syntax. For example, data.firstName
Also, you may need to need to change this line in your PHP file from
echo json_encode($array);
to
header('Content-Type: application/json');
echo json_encode($array);
Also, your PHP script needed some cleaning up:
<?php
include("dbconnect.php");
$dbQuery = mysql_query("SELECT * FROM users ORDER BY lastName ASC;");
while ($dbRow = mysql_fetch_array($dbQuery)) {
$userID = $dbRow['id'];
$username = $dbRow['username'];
$firstName = $dbRow['firstName'];
$lastName = $dbRow['lastName'];
$jobTitle = $dbRow['jobTitle'];
$userteam = $dbRow['TaskTeam'];
$admin = $dbRow['admin'];
echo '
<tr>
<td>
<button type="button" class="btn btn-primary close" data-toggle="modal" data-target="#editUserModal" value='.$userID.' id="user" name="user"" data-user='.$userID.'><span title="Edit" aria-hidden="true" class="glyphicon glyphicon-edit"></span></button>
</td>
<td>'.$firstName.'</td>
<td>'.$lastName.'</td>
<td>'.$jobTitle.'</td>
<td>'.$userteam.'</td>
<td>'.$admin.'</td>
<td>
<a href="deleteUser.php?id='.$userID.'">
<button type="button" name="delete_row" id="delete_row" class="close">
<span title="Delete" aria-hidden="true" class="glyphicon glyphicon-trash"></span>
<span class="sr-only">Delete</span>
</button>
</a>
</td>
</tr>';
}
echo mysql_error();
mysql_close();
?>
I have a user list on an HTML table, when I click an entry I have a modal loading through AJAX which should fill a form out with all the relevant information from that user. Information can then be changed and submitted via a change.
I cannot get past getting the modal to load and cannot get data to be loaded into the model.
Here is the script:
<script>
$('#editUserModel').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('userID')
$(function ()
{
$.ajax({
url: 'getUser.php?id=',
data: "recipient",
dataType: 'json',
success: function(data)
{
var id = data[0]; //get id
var firstName = data[1]; //get name etc...
var lastName = data[2];
var username = data[3];
var password = data[4];
var jobTitle = data[5];
var TaskTeam = data[6];
var admin = data[12];
var modal = $(this)
modal.find('.modal-body input').html(username)
}
});
});
})
</script>
Here is the PHP which lists the users (this works and when I click the Edit button a modal loads however the modal is grayed out and shows no underlying data)
<?php
include("dbconnect.php");
$dbQuery= mysql_query("SELECT * FROM users ORDER BY jobTitle ASC;");
while($dbRow = mysql_fetch_array($dbQuery))
{
$userID = $dbRow['id'];
$username = $dbRow['username'];
$firstName = $dbRow['firstName'];
$lastName = $dbRow['lastName'];
$jobTitle = $dbRow['jobTitle'];
$userteam = $dbRow['TaskTeam'];
echo '<tr>';
echo '<td>';
echo '<button type="button" class="btn btn-primary close" data-toggle="modal" data-target="#editUserModel" data-userID='.$userID.'><span title="Edit" aria-hidden="true" class="glyphicon glyphicon-edit"></span></button>';
echo '</td>';
echo '<td>'.$firstName.'</td>';
echo '<td>'.$lastName.'</td>';
echo '<td>'.$jobTitle.'</td>';
echo '<td>'.$userteam.'</td>';
echo '<td></td>';
/*
echo '<td>';
echo '</td>';
*/
echo '</tr>';
}
echo mysql_error();
mysql_close();
?>
Here is the modal div:
<div class="modal fade" id="editUserModel" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="editModalLabel"></h4>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="username" class="control-label">Username:</label>
<input type="text" class="form-control" id="username">
</div>
<div class="form-group">
<label for="password" class="control-label">Password:</label>
<input type="text" class="form-control" id="password">
</div>
<div class="form-group">
<label for="firstName" class="control-label">First Name:</label>
<input type="text" class="form-control" id="firstName">
</div>
<div class="form-group">
<label for="lastName" class="control-label">Surname:</label>
<input type="text" class="form-control" id="lastName">
</div>
<div class="form-group">
<label for="jobTitle" class="control-label">Job Title:</label>
<input type="text" class="form-control" id="jobTitle">
</div>
<div class="form-group">
<label for="TaskTeam" class="control-label">Task Team:</label>
<input type="text" class="form-control" id="TaskTeam">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Submit Changes</button>
</div>
</div>
</div>
</div>
And here is the php file which retrieves the user data:
<?php
$userID = intval($_GET['id']);
include("dbconnect.php");
$sql="SELECT * FROM users WHERE id = $userID";
$result = mysql_query($sql);
$array = mysql_fetch_row($result);
echo json_encode($array);
mysql_close();
?>
I don't fully understand PDO, I'm not sure where the problem is.
Rahter than mysql use mysqli. Also, the problem is happening because you need to iterate through your rows result. Try this:
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$userID = intval($_GET['id']);
$sql="SELECT * FROM users WHERE id = $userID";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
$array = array();
while($row = $result->fetch_assoc()) {
array_push($array, $row);
}
echo json_encode($array);
} else {
echo "0 results";
}
$conn->close();
Then in your JS, replace the contents of .success with this:
success: function(data) {
var obj = JSON.parse(data);
$.each(obj, function(key, val) {
console.log(val);
//add your functions here
/*
var id = data[0]; //get id
var firstName = data[1]; //get name etc...
var lastName = data[2];
var username = data[3];
var password = data[4];
var jobTitle = data[5];
var TaskTeam = data[6];
var admin = data[12];
var modal = $(this)
modal.find('.modal-body input').html(username)
*
*/
});
}