How i can do a multiple dynamic popup - php

This code would complete the table, that work find. The problem with this is that when i can show a dynamic popup only work in the first row but in anyelse don't work
<tr>
<td><img src="../mysql/img/<?php echo $fila['imagen'];?>" class="logoempresa" alt="Logo empresa"></td>
<?php $fila['id'];?>
<td><?php echo $fila['empresa'];?></td>
<td><?php echo $fila['puesto'];?></td>
<td><?php echo $fila['jornada'];?></td>
<td><?php echo $fila['salario'];?></td>
<td><?php echo $fila['zona'];?></td>
<td>
<div class="popup-flex">
<button id="popup-btn">Click Me</button>
</div>
<div id="popup-wrapper" class="popup-container">
<div class="popup-content">
<span id="close">×</span>
<p class="observaciones"><?php echo $fila['observaciones'];?></p>
</div>
</div>
</td>

try
<button id="<?= $fila['id'];?> " class="popup-btn">Click Me</button>
jquery
$('.popup-btn').on('click', function(e){
e.preventDefault()
let id = $(this).attr('id')
//do magic
})

Using vanilla Javascript you might try like this. Remove the ID attributes or convert to dataset versions such as data-id="popup-wrapper" rather than id="popup-wrapper" and use the click event triggered by the button to locate that element in the DOM tree. From that point you can navigate up the DOM tree and query once more to find the POPUP. Once you have identified the popup - open it or do something.. here I just toggle a className.
All the PHP tags below have been removed simply to facilitate the snippet/demo...
const clickhandler=function(e){
let popup=this.parentNode.parentNode.querySelector('[data-id="popup-wrapper"]');
popup.classList.toggle('popped');
/* Open the popup... sing and dance! */
};
document.querySelectorAll('.popup-flex > [data-id="popup-btn"]').forEach( bttn=>bttn.addEventListener('click',clickhandler))
.popped{border:2px solid red;}
td{border:1px solid grey}
<table>
<tr>
<td><img src="//placekitten.com/100/100" class="logoempresa" alt="Logo empresa"></td>
<td>$fila['empresa']</td>
<td>$fila['puesto']</td>
<td>$fila['jornada']</td>
<td>$fila['salario']</td>
<td>$fila['zona']</td>
<td>
<div class="popup-flex">
<button data-id="popup-btn">Click Me</button>
</div>
<div data-id="popup-wrapper" class="popup-container">
<div class="popup-content">
<span data-id="close">×</span>
<p class="observaciones">$fila['observaciones']</p>
</div>
</div>
</td>
</tr>
<tr>
<td><img src="//placekitten.com/100/100" class="logoempresa" alt="Logo empresa"></td>
<td>$fila['empresa']</td>
<td>$fila['puesto']</td>
<td>$fila['jornada']</td>
<td>$fila['salario']</td>
<td>$fila['zona']</td>
<td>
<div class="popup-flex">
<button data-id="popup-btn">Click Me</button>
</div>
<div data-id="popup-wrapper" class="popup-container">
<div class="popup-content">
<span data-id="close">×</span>
<p class="observaciones">$fila['observaciones']</p>
</div>
</div>
</td>
</tr>
<tr>
<td><img src="//placekitten.com/100/100" class="logoempresa" alt="Logo empresa"></td>
<td>$fila['empresa']</td>
<td>$fila['puesto']</td>
<td>$fila['jornada']</td>
<td>$fila['salario']</td>
<td>$fila['zona']</td>
<td>
<div class="popup-flex">
<button data-id="popup-btn">Click Me</button>
</div>
<div data-id="popup-wrapper" class="popup-container">
<div class="popup-content">
<span data-id="close">×</span>
<p class="observaciones">$fila['observaciones']</p>
</div>
</div>
</td>
</tr>
</table>

Related

How do I echo a clickable URL in PHP?

How do I echo a clickable URL in PHP?
i want to makes this code as a clickable link, so i can click it, but i got no idea how to make it. Please help me if you know this case.
picture of the problem code
and these are my code :
<div class="container-fluid">
<div class="card">
<div class="card-header">Detail Shelter</div>
<div class="card-body">
<?php foreach($shelter as $slt): ?>
<div class="row">
<div class="col-md-4">
<img src="<?php echo base_url().'/upload/'.$slt->gambar ?>" class="card-img-top">
</div>
<div class="col-md-8">
<table class="table">
<tr>
<td>Nama Shelter</td>
<td><strong></strong><?php echo $slt->nama_shelter ?></td>
</tr>
<tr>
<td>Lokasi Shelter</td>
<td><strong></strong><?php echo $slt->lokasi_shelter?></td>
</tr>
<tr>
<td>Deskripsi</td>
<td><strong></strong><?php echo $slt->deskripsi ?></td>
</tr>
<tr>
<td>Telpon</td>
<td><strong></strong><?php echo $slt->no_telp ?></td>
</tr>
</table>
<?php echo anchor('dashboard/index',
'<div class="btn btn-sm btn-danger"> Kembali </div>') ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
To make a link clickable you need to use the tag see HERE
For example:
<tr>
<td>Lokasi Shelter</td>
<td><strong></strong>LINK TEXT</td>
</tr>
assuming the link you want is <?php echo $slt->lokasi_shelter?>
You just need to do this : click here

How to loop through all the records in jquery datatable in php

I have JQUERY datatable in my PHP page in which I have one check box, I want to get the values of all the check boxes checked in that datatable with php code by using
implode(',',$_POST['accessflag']);
But it is showing the values only on the current page. I want to get the values of all checked check boxes in the datatable from all the pages of that particular table .anybody please help me to get this done.
my HTML code is
<div class="row control-container pt-2">
<div class="table-responsive col-md-12">
<div class="row">
<div class="col-md-12" style="text-align:center">
<label style="color:red">
<?php if (isset($_SESSION['SaveMsg'])) { echo $_SESSION['$SaveMsg'];unset($_SESSION['$SaveMsg']);}?>
</label>
</div>
</div>
<table id="moduletable" class="table table-sm table-bordered table-hover table-lightfont display">
<thead class="thead-light">
<tr>
<th><?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","GRP_DESC"); ?></th>
<th><?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","MODULE_NAME"); ?></th>
<th><?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","GMA_ACCESS_FLAG"); ?></th>
<th><?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","OPTIONS"); ?></th>
</tr>
</thead>
<tbody>
<?php
if(isset($_SESSION['$nextset'])){
$limit=$_SESSION['$nextset'];}
else{$limit=0;}
if ($_SESSION['$language']="E") {
$groupdata=SelectData("group_module_access,user_group,modules","gma_id,gma_grp_id,grp_desc,gma_module_id,module_name,gma_access_flag","gma_grp_id=grp_id and gma_module_id=module_id","gma_grp_id,gma_id LIMIT ".$limit.",50");
}
else {
$groupdata=SelectData("group_module_access,user_group,modules","gma_id,gma_grp_id,grp_bldesc as grp_desc,gma_module_id,module_blname as module_name,gma_access_flag","gma_grp_id=grp_id and gma_module_id=module_id","gma_grp_id,gma_id LIMIT ".$limit.",50");
}
foreach ($groupdata as $groupdatalist) {?>
<tr>
<td><?php echo $groupdatalist["grp_desc"];?></td>
<td><?php echo $groupdatalist["module_name"];?></td>
<?php if($groupdatalist["gma_access_flag"]=="N"):?>
<td style="text-align:right;width:10px;"><input type="checkbox" name="accessflag[]" id="accessflag"
value="<?php echo "{$groupdatalist['gma_id']}"?>"/> </td>
<?php else:?>
<td style="text-align:right;width:10px;"><input type="checkbox" checked name="accessflag[]" id="accessflag" width="10px"
value="<?php echo "{$groupdatalist['gma_id']}"?>"/> </td>
<?php endif;?>
<!--<td style="display:none;"><//?php echo $groupdatalist["gma_grp_id"];?></td>
<td style="display:none;"><//?php echo $groupdatalist["gma_module_id"];?></td>
<td style="display:none;"><input type="text" name="gmaid" id="gmaid" value="<//?php echo $groupdatalist["gma_id"];?>"></td>-->
<td>
<?php if($groupdatalist["gma_access_flag"]=="N"):?>
<a href="#" class="btn btn-light btn-sm pt-0 shadow-none"
data-toggle="tooltip" title="<?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","MENUPERMISSION");?>">
<i class="fa fa-pencil-square-o"></i>
</a>
<?php else:?>
<a href="group_action.php?gmagrpid=<?php echo $groupdatalist['gma_grp_id']?>&gmamoduleid=<?php echo $groupdatalist['gma_module_id']?>&page=MenuPermission&gmagrpdesc=<?php echo $groupdatalist['grp_desc']?>&gmamodulename=<?php echo $groupdatalist['module_name']?>" class="btn btn-light btn-sm pt-0 shadow-none"
data-toggle="tooltip" title="<?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","MENUPERMISSION");?>">
<i class="fa fa-pencil-square-o"></i>
</a>
<?php endif;?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="row">
<div class="col-md-12 text-right">
<button type="submit" name="updmodaccess" formnovalidate class="btn nc btn-primary btn-rounded">
<i class="fa fa-save"></i>
<?php echo GetBilingualLabels($_SESSION['$language'],"BUTTON","SAVE"); ?>
</button>
</div>
</div>
</div>
</div>
PHP code on updmodaccess button is
if (isset($_POST['updmodaccess'])) {
$keytoupdate=implode(',',$_POST['accessflag']);
$table="group_module_access"; $data=array("gma_access_flag"=>"Y", "gma_upd_dt"=>GetDateTime($_SESSION['$TimeZone']), "gma_upd_uid"=>"{$_SESSION['$userid']}");
UpdateData($table,$data,"gma_id in (".$keytoupdate.")",$Message,$flg);
$data=array("gma_access_flag"=>"N", "gma_upd_dt"=>GetDateTime($_SESSION['$TimeZone']), "gma_upd_uid"=>"{$_SESSION['$userid']}");
UpdateData($table,$data,"gma_id not in (".$keytoupdate.")",$Message,$flag);
}
you can try the following code. I hope it helps.
you need to get these values using ajax and then need to send this value to php using an ajax.
$(document).ready(function(){
var data = new Object();
var table = $('#addUsersToAboTable').DataTable();
$('#addUsersToAboTable').on('change', ':checkbox', function () {
data[table.row($(this).parents('tr').get(0)).index()] = this.checked;
});
$('#getDataBtn').on('click',function(){
console.log(data);
});
});
Here you can see the demo script as well jQuery Datatables, How to get all selected checkboxes from EVERY page

passing parameter to modal window with data-target is not working

I have designed one page consisting of one modal window which is opening with tag.
I want to pass some parameters to modal window which i will be using to populate table data based on the parameter value.It is working with one parameter but not working with another parameter.
Following is the HTML to open modal window......
<table id="MyTable1" class="table table-sm table-striped table-lightfont paginated">
<thead class="thead-light">
<tr>
<th><?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","GRP_DESC"); ?></th>
<th><?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","MODULE_NAME"); ?></th>
<th><?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","GMA_ACCESS_FLAG"); ?></th>
<th><?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","OPTIONS"); ?></th>
</tr>
</thead>
<tbody>
<?php
if ($_SESSION['$language']="E") {
$groupdata=SelectData("group_module_access,user_group,modules","gma_id,gma_grp_id,grp_desc,gma_module_id,module_name,gma_access_flag","gma_grp_id=grp_id and gma_module_id=module_id","gma_grp_id,gma_id");
}
else {
$groupdata=SelectData("group_module_access,user_group,modules","gma_id,gma_grp_id,grp_bldesc as grp_desc,gma_module_id,module_blname as module_name,gma_access_flag","gma_grp_id=grp_id and gma_module_id=module_id","gma_grp_id,gma_id");
}
foreach ($groupdata as $groupdatalist) {
//$allids[]=$groupdatalist["gma_id"]; ?>
<tr>
<td><?php echo $groupdatalist["grp_desc"];?></td>
<td><?php echo $groupdatalist["module_name"];?></td>
<?php if($groupdatalist["gma_access_flag"]=="N"):?>
<td style="text-align:right;width:10px;"><input type="checkbox" name="accessflag[]" id="accessflag"
value="<?php echo "{$groupdatalist['gma_id']}"?>"/> </td>
<?php else:?>
<td style="text-align:right;width:10px;"><input type="checkbox" checked name="accessflag[]" id="accessflag" width="10px"
value="<?php echo "{$groupdatalist['gma_id']}"?>"/> </td>
<?php endif;?>
<td style="display:none;"><?php echo $groupdatalist["gma_grp_id"];?></td>
<td style="display:none;"><?php echo $groupdatalist["gma_module_id"];?></td>
<td style="display:none;"><input type="text" name="gmaid" id="gmaid" value="<?php echo $groupdatalist["gma_id"];?>"></td>
<!--<td style="display:none"><input type="text" name="allids[]" value="<//?php echo "{$groupdatalist['gma_id']}"?>"/></td>-->
<td>
<span data-toggle="modal" data-target="#myModal-<?php echo $groupdatalist['gma_id'];?>">
<a href="#" class="btn btn-light btn-sm shadow-none"
data-toggle="tooltip" title="<?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","MENUPERMISSION");?>">
<i class="fa fa-pencil-square-o"></i>
</a>
</span>
</td>
</tr>
<?php } ?>
</tbody>
</table>
Here is the modal window HTML.....
<div id="myModal-<?php echo $groupdatalist['gma_grp_id'];?>" class="modal show fade" data-backdrop="static">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h6 class="modal-title">Menu List</h6>
</div>
<div class="modal-body">
<div class="control-container" style="padding:10px;">
<div class="row">
<div class="col-md-12" style="text-align:center">
<label style="color:red">
<?php //session_start();
if (!empty($_SESSION['$SaveMsg'])) { echo $_SESSION['$SaveMsg']; }
unset($_SESSION['$SaveMsg']);
?>
</label>
</div>
</div>
<div class="row">
<div class="col-md-4">
<label><?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","GRP_DESC"); ?>
</label>
</div>
<div class="col-md-8">
<input class="text-control" type="text" name="grpid" id="grpid"
value="" readonly required maxlength="50" style="width:100%;display:none;" autofocus />
<input class="text-control" type="text" name="grpname" id="grpname"
value="" readonly required maxlength="50" style="width:100%" autofocus />
</div>
</div>
<div class="row">
<div class="col-md-4">
<label><?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","MODULE_NAME"); ?>
</label>
</div>
<div class="col-md-8">
<input class="text-control" type="text" name="moduleid" id="moduleid"
value="" readonly required maxlength="50" style="width:100%;display:none" autofocus />
<input class="text-control" type="text" name="modulename" id="modulename"
value="" readonly required maxlength="50" style="width:100%" autofocus />
</div>
</div>
<?php $gmaid= "<script>document.writeln(gmaid);</script>";
echo $gmaid;?>
<!--table starts here -->
<table id="MyTable2" class="table table-sm table-striped table-lightfont paginated">
<thead class="thead-light">
<tr>
<th><?php echo GetBilingualLabels($_SESSION['$language'],"MENUACCESS","MENUNAME"); ?></th>
<!--<th><//?php echo GetBilingualLabels($_SESSION['$language'],"MODULEACCESS","MODULE_NAME"); ?></th>-->
<th><?php echo GetBilingualLabels($_SESSION['$language'],"MENUACCESS","ACCESS_FLAG"); ?></th>
<!--<th><//?php echo GetBilingualLabels($_SESSION['$language'],"MENUACCESS","OPTIONS"); ?></th>-->
</tr>
</thead>
<tbody>
</table>
<!-- table ends here -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">
<i class="fa fa-close"></i>
<?php echo GetBilingualLabels($_SESSION['$language'],"BUTTON","CANCEL"); ?>
</button>
<button type="submit" name="updmenuperm" formnovalidate class="btn btn-primary"> <!--onclick="DispMsg(<//?php echo "'".$_SESSION['AlertMsg']."'";?>)"-->
<i class="fa fa-save"></i>
<?php echo GetBilingualLabels($_SESSION['$language'],"BUTTON","SAVE"); ?>
</button>
</div>
</div>
</div>
</div>
</div>
Above code is working perfectly but if i am using another value as parameter it is not opening the modal window at all.
for ex. if i am using $groupdatalist['gma_id'] which is integer value, it is not opening modal window.
Multiple issues here.
First a </div> is missing at the end.
Then you are defining $groupdatalist in a foreach, but trying to use it outside the loop:
<div id="myModal-<?php echo $groupdatalist['gma_grp_id'];?>" class="modal show fade" data-backdrop="static">
If you want one modal per <td> you have to move your modal into the foreach loop.
Finally, you call the modal using $groupdatalist['gma_id']
<span data-toggle="modal" data-target="#myModal-<?php echo $groupdatalist['gma_id'];?>">
but the modal ID is define using a different variable : $groupdatalist['gma_grp_id']:
<div id="myModal-<?php echo $groupdatalist['gma_grp_id'];?>"

why my sliding box is not working as per specific divisions

<TD><script type="text/java script">
$(document).ready(function(){
$("#sliding div").hide();
$("#show_hide").show();
$('#show_hide').click(function(){
$("#sliding Div").slide Toggle();
});
});
</script>
while ($row1=mysql_fetch_array($sql))
{
?>
<div class="services_box">
<!--<div class="services_box_title"><h3 align="center">Location: </h3></div>-->
<div class="services_box_mid_cont">
<div class="inner 3" style="padding;">
<div class="inner 3_left"><a h ref="#"><img src="upload_image/
<?php echo $row 1['image']; ?>" height="100px" width="150px"/></a></div>
<div class="inner3_right">
<div class="heading">
<label id=titl><a href="view.php?Post_id=
<?php echo $row1['Post_id'];?>"><?php echo $row1['title'];?></a></label></div>
<div class="para"><div style="width:380px; height:80px; overflow:auto;">
<a id="desc" href="#"> <label id=desc><?php echo $row1['description'];?>
</label> </a></div> </div>
<div class="btn"><a href="#" id="show_hide">
<img src="images/button-reply.png" width="76" height="27" /></a></div>
</div>
<div class="clear"></div>
<div class="date_time"><h3>Posted On :<?php echo $row1['date_time'];?></h3></div>
<?php echo $row1['city']; ?>
<div class="contact_no">
<h3 align="right">Contact:<?php echo $row1['user_mobno'];?> </h3></div>
</div>
</div>
<div class="clear"></div>
</div>
<div class="sliding Div" id="sliding Div">
<div class="clear"></div>
<table width="69" style="border:#CCCCCC 1px solid;">
<tr class="head_bg">
<TD width="132">Name</TD>
<TD width="100">Email Id</TD>
<TD width="194">Mobile</TD>
</tr>
<tr><TD col span="7" style="border-bottom:#CCCCCC 1px solid;"></td></tr>
<tr class="head_bg">
<TD width="400"><input type=text></TD>
<TD width="400"><input type=text></TD>
<TD width="400"><input type=text></TD>
</tr>
</table></div>
this code is working for a single div only not for the all div. here is my div in while loop;i am trying my best to execute the code successfullyy but it is not working.
plz immidiate ly tell me the solution..
$("#sliding Div").slide Toggle();
should be
$("#sliding Div").slideToggle();
You have give the id name as:
id="sliding Div"
Change it to id="sliding_div" in the id there should not be space.
OR you can use the below JS:
$(document).ready(function(){
$(".sliding").hide();
$("#show_hide").show();
$('#show_hide').click(function(){
$(".sliding").slideToggle();
});
});

Display specific row data in bootstrap modal with edit button click

I am new to programming and trying to implement bootstrap modal to display row data from a mysql table into the modal window.
I have tried the solution found on stackoverflow "Pull information from mysql table to bootstrap modal to edit" by link. But could not able to display the particular row with the $row['SFID'].
I can pull table data but when I click the edit button in front of any row it always show the last row id
and doesn't display the data in the input box on the modal to edit the data???.
Here I am till now, Please help me out.
<table class="table table-bordered" width="100%">
<thead>
<tr>
<th>SFID</th>
<th>Company</th>
<th>Product</th>
<th>Product Line</th>
<th>Dealer Class</th>
<th>Status</th>
</tr>
</thead>
<?php
$query = "SELECT * FROM tblcustomer";
$stmt = $db->prepare($query);
$stmt->execute();
foreach ($stmt as $row): ?>
<tr>
<?php $rowID = $row['SFID']; ?>
<td><?php echo $row['SFID']; ?></td>
<td><?php echo $row['CompanyName']; ?></td>
<td><?php echo $row['Product']; ?></td>
<td><?php echo $row['ProductLine']; ?></td>
<td><?php echo $row['DealerClass']; ?></td>
<td><?php echo $row['RequestStatus']; ?></td>
<td style="text-align: center">
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn btn-danger" href="#delModal" data-toggle="modal"><i class="icon-trash icon-white"></i> Delete</a>
<?php echo "<a class='btn update' href='#editModal' data-sfid='".$row['SFID']."' role='button' data-toggle='modal'>Edit</a>"; ?>
</div>
</div>
</td>
</tr>
<?php endforeach; ?>
</table>
<div id="editModal" class="modal hide fade in" style="display: none; ">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Edit Customer Details</h3>
</div>
<div>
<form class="contact">
<fieldset>
<div class="modal-body">
<?php echo $row['SFID']; ?>
<ul class="nav nav-list">
<li class="nav-header">SFID</li>
<li><input class="input-xlarge" type="text" name="mysfid" id="mysfid"></li>
<!--<li class="nav-header">Company</li>
<li><input class="input-xlarge" value=" " type="text" name="mycompany"></li>
<li class="nav-header">Dealer Class</li>
<li><input class="input-xlarge" value=" " type="text" name="mydealerclass"></li> -->
</ul>
</div>
</fieldset>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-success" id="submit">Approved</button>
Close
</div>
</div>
<script>
$(document).ready(function(){
$('a.edit').click(function(){
var sfid = $(this).data('sfid');
var company = $(this).data('company');
var dealerclass = $(this).data('dealerclass');
$('#mysfid').val(sfid);
$('#mycompany').val(company);
$('#mydealerclass').val(dealerclass);
});
});
</script>
Thanks for your help.
<table class="table table-bordered" width="100%">
<thead>
<tr>
<th>SFID</th>
<th>Company</th>
<th>Product</th>
<th>Product Line</th>
<th>Dealer Class</th>
<th>Status</th>
</tr>
</thead>
<?php
$query = "SELECT * FROM tblcustomer";
$result = mysql_query($query);
$i=1;
while($row = mysql_fetch_assoc($result))
{
?>
<tr>
<?php $rowID = $row['SFID']; ?>
<td><?php echo $row['SFID']; ?></td>
<td><?php echo $row['CompanyName']; ?></td>
<td><?php echo $row['Product']; ?></td>
<td><?php echo $row['ProductLine']; ?></td>
<td><?php echo $row['DealerClass']; ?></td>
<td><?php echo $row['RequestStatus']; ?></td>
<td style="text-align: center">
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn btn-danger" href="#delModal" data-toggle="modal"><i class="icon-trash icon-white"></i> Delete</a>
<a class="btn update" href="#editModal<?php echo$i?>" data-sfid='"<?php echo $row['SFID'];?>"' data-toggle="modal">Edit</a>
<!--Yor Edit Modal Goes Here-->
<div id="editModal<?php echo $i; ?>" class="modal hide fade in" role="dialog" ria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Edit Customer Details</h3>
</div>
<div>
<form class="contact">
<fieldset>
<div class="modal-body">
<?php echo $row['SFID']; ?>
<ul class="nav nav-list">
<li class="nav-header">SFID</li>
<li><input class="input-xlarge" type="text" name="mysfid" id="mysfid"></li>
<!--<li class="nav-header">Company</li>
<li><input class="input-xlarge" value=" " type="text" name="mycompany"></li>
<li class="nav-header">Dealer Class</li>
<li><input class="input-xlarge" value=" " type="text" name="mydealerclass"></li> -->
</ul>
</div>
</fieldset>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-success" id="submit">Approved</button>
Close
</div>
</div>
</div>
</div>
</td>
</tr>
<?php $i++; } ?>
</table>
take $i = 1 above for loop and increament it in each iteration of for loop..so it will take each records
Your Form
<a class='btn update' href='#editModal<?php echo $i;?>' data-sfid='".$row['SFID']."' role='button' data-toggle='modal'>Edit</a>
Modal Window
<div id="editModal<?php echo $i;?>" class="modal hide fade in" style="display: none; ">
That's because you fill the edit modal with the $row data, which by then, is on the last item.
To get data for a specific row, you could create a javascript object/array and then fetch the data by making use of the data-rfid parameter in the "Edit" link. Or you can fetch the row with Ajax for example.

Categories