Hy,
I'm using php to create a table with all users, and then, when I click on the checkbox, remove them.
// This is the code to print the users table

			foreach ($result as $row){	
				$user = $row['users_id'];
				echo '<tr><td> ' . $row['username'] . ' </td><td> ' . $row['permission'] . ' </td> <td> <input type="checkbox" name=' . $row['users_id'] . ' value=' . $row['users_id'] . ' " ></td></tr> ' ;

}

I was goin to include on the checkbox input this "onclick="removeuser('.$user.')" , and then a javascript or php function like these:

function removeuser('.$user.')
	{
		<?php
		$db = new PDO('sqlite:backup.sqlite');
		$result = $db->query('DELETE * FROM users where username="'.$user.'";');
		?>
	}

But this doesn't do nothing 🙁

    An onclick event is running JavaScript on the client side (browser), but you want to do something that runs on the server side (where your PHP and database run). One option would be to have your onclick event call a JavaScript function that makes an AJAX call to a PHP script on the server, sending POST parameters to tell it which user to delete.

      To make things even simpler, you probably want to look at using jQuery for the AJAX event, as it handles all the cross browser compatibility you need to worry about and makes things much simpler to get going.

        Derokorian;11026281 wrote:

        To make things even simpler, you probably want to look at using jQuery for the AJAX event, as it handles all the cross browser compatibility you need to worry about and makes things much simpler to get going.

        I don't know a lot about jQuery, could you help me with what am I looking for ?

          12 days later

          Is there any way to implement it on client side ?

            Write a Reply...