-3
<input type="checkbox" name="tag_1" onclick="<?php echo base_url('zohaib_work_controler/activity/'.$row->id.'/'.$row->active);?>"  value="yes" <?php echo ($row->active==1 ? 'checked' : 'unchecked');?>> </td>

I wan't to run the php function when click on the checkbox. which show the activity of the user. but it can't run why?

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
  • You would have to use AJAX to fire of a request when the user interacts with the checkbox, and update the page based on the response received. – Mikey Feb 10 '16 at 15:03

1 Answers1

1

PHP gets parsed on the server, which delivers the HTML to your user's browser when they request it. The click then happens in the browser. To run a function when the user clicks one can do one of 2 things:

1) Write the function in Javascript if no server assets are needed, or

2) Use Javascript to make an AJAX call to the server where your PHP function is run and then the result returned.

wogsland
  • 9,106
  • 19
  • 57
  • 93