I need help processing data form a table PHP/HTML -
i creating scheme website allow admin of website take , reject new user registrations admin panel.
the table not actual table, example:
<th>username</th> <th>email</th> <th>real name</th> <th>checkbox</th> <button>activate user</button> <button>delete user</button>
the checkbox actual checkbox in real table.
when admin logs in , goes take users have sql command collect users not activated , shows them in illustration table above.
what want know is, using checkbox on table, how can allow admin check checkbox select multiple users , either take them or delete them? know sql command need utilize , else don't know how set table when checkbox checked either on single user or multiple users of info processed , action taken e.g. user activated or deleted.
p.s. sorry, realised supposed form. bad!
in form should utilize []
(array of checkbox). ex.
html :
while (iterate through registration requests) { echo "<input name='users[]' value='$user_id' type='checkbox'>"; }
while in backend can checkbox's values as,
php :
$users = $_post['users']; // have array of checked checkbox's values $users_list = "'". implode("','", $users) ."'";
here, in $users_list
, you'll have list of users. eg. 'user1','user2','user3','users4', .....
then can run query mark users registered. ( pseudo query)
update table_name set approved = '1' user_id in ($users_list);
you can utilize above logic delete requests also.
php html forms table
No comments:
Post a Comment