with table i fetch data in tabular format and with each row there is add button.
<a href="#" data-id="<?php echo $row[0];?>" name="pppid" class="btn btn-primary filter" data-toggle="modal" data-target="#myModal1" name="">ADD</a>
it will open modal now i want only each rows data in modal.
<div class="modal fade" id="myModal1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<table id="name52" class="table table-striped table-bordered table-hover scroll" style="width:100%;">
<thead>
<tr>
<th>Project Name</th>
<th>Module Name</th>
<th>Actual Start Date</th>
<th>Actual End Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
$fetch =$_REQUEST['pppid'];
$sql1=mysql_query("select * from `project_assigned` where `proj_ass_id`='$fetch'");
while ( $row1 = mysql_fetch_array($sql1))
{?>
<tr>
<input required type='hidden' class='insert' value="<?php echo $row1[0]?>">
<td><?php echo get_name("add_project","project_id",$row1['project_id'],"project_name");?><input id="project_id" type="text" class="insert" value="<?php echo $row1['project_id'];?>"></td>
<td><?php echo get_name("add_project_module","module_id",$row1['module_id'],"module_name");?><input id="module_id" type="text" class="insert" value="<?php echo $row1['module_id'];?>"></td></td>
<input class="insert" type="hidden" name="" value="<?php echo $row1['emp_id'];?>">
<td><input class="controls input-group date insert" type="text" name=""></td>
<td><input class="controls input-group date insert" type="text" name=""></td>
<td><select class="insert">
<option value="In Progress">In Progress</option>
<option value="Completed">Completed</option>
</select></td>
</tr>
<?php }?>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary submit">Submit</button>
</div>
</div>
</div>
</div>
when i use this code with
$fetch
variable that i declare in anchor tag it will not display that particular row. As this request is not working for me I used another way to call ajax on ajax page i write query and script to fetch records but its also not working. my ajax page is working it shows data but below script for this is not working.
<script>
$('.filter').click(function(){
var id = $(this).data('id');
alert(id);
$.ajax({url:"modal_emp_status.php"+id,cache:false,success:function(result){
alert(var str = result.split(","));
alert($("#project_id").val(str[0]));
alert($("#module_id").val(str[1]));
}});
});
</script>
my ajax page working:
<?php
include('config.php');
$sql = mysql_query("select * from `project_assigned` where `proj_ass_id`='1'");
$data = mysql_fetch_array($sql);
$str = $data['project_id'].",".$data['module_id'];
echo $str;
?>
in image you can see add button. on click add button modal will open but i want only particular row to display in modal.