Welcome Guest, Not a member yet? Register   Sign In
html tr onclick to call controller function
#2

Hi

You can write something like below:

Code:
<table>
    <tr onClick="editData(<?php echo $row['id'];?>)"><td><?php echo $row['id'];?></td><td><?php echo $row['name'];?></td></tr>
</table>
<form name="frmEdit" id="frmEdit" action=<?php echo base_url();?>controller_name/action_name" method="post"/>
<input type="hidden" name="id" id="id" value="" />
</form>
<script>
function editData(id)
{
    $("#id").val(id);
    document.frmEdit.submit();    
}
</script>
Reply


Messages In This Thread
RE: html tr onclick to call controller function - by Bhavesh - 02-05-2016, 09:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB