<?php function print_users() { $users = array(0 => array( 'user_id' => 1,'user_name' => 'you'),2 => array( 'user_id' => 2,'user_name' => 'her')); ?> <script> function change_status() { var status = document.getElementById("users_status").value; window.location = "index.php?page=<?php echo $page; ?><?php if($users_order_by){ echo "&order_by=".$users_order_by;} ?><?php if($users_order){echo "&order=".$users_order;} ?>&status=" +status; } </script> <form method="post" name="grid_users"> <h3>Users</h3> <fieldset> <?php if($_POST) { print_r($_POST); for ($i=0; $i<count($_POST['users_select']); $i++) { if($_POST['users_select'][$i] != "") { //User::remove_user($_POST['users_select'][$i]); } } ?> <div class="success">All Selected users has been deleted successfully .. !!</div> <?php } ?> <select name="users_status" id="users_status" onchange="change_status();"> <option value="">---</option> <option value="active">Active</option> <option value="not_active">Not Active</option> <option value="blocked">Blocked</option> </select> <div style="float: right;"> <input type="submit" name="submit" value="delete" /> </div> <table width="100%" style="text-align: center; margin-top: 20px;"> <tr> <?php if($users_order == "ASC"){$users_order = "DESC";} ?> <th><a href="index.php?page=users&order_by=id&order=<?php echo $users_order; ?>">ID</a></th> <th><a href="index.php?page=users&order_by=name&order=<?php echo $users_order; ?>">Full Name</a></th> <th><a href="index.php?page=users&order_by=email&order=<?php echo $users_order; ?>">Email</a></th> <th><a href="index.php?page=users&order_by=gender&order=<?php echo $users_order; ?>">Gender</a></th> <th><a href="index.php?page=users&order_by=status&order=<?php echo $users_order; ?>">Active</a></th> <th><a href="index.php?page=users&order_by=register_date&order=<?php echo $users_order; ?>">Registered</a></th> <th width="100">Action</th> <th>select</th> </tr> <?php if(count($users)>0){ $counter = 0; foreach ($users as $user){ $counter += 1;?> <tr <?php if( ($counter % 2) != 0 ){echo 'class="odd"';} ?>> <td><?php echo $user['user_id']; ?></td> <td><a href="index.php?page=users&sub_page=control_users&action=view&user_id=<?php echo $user['user_id']; ?>"><?php echo htmlspecialchars($user['user_name']); ?></a></td> <td><?php echo $user['user_email']; ?></td> <td><?php if($user['user_gender'] == 1){echo "Male";}else{echo "Female";} ?></td> <td><?php echo $user['user_status']; ?></td> <td><?php echo $user['user_register_date']; ?></td> <td> <a href="index.php?page=users&sub_page=control_users&action=edit&user_id=<?php echo $user['user_id']; ?>"> <img src="style/icons/user_edit.png" title="Edit user"/></a><a href="index.php?page=users&sub_page=control_users&action=delete&user_id=<?php echo $user['user_id']; ?>"> <img src="style/icons/user_delete.png" title="Delete user"/></a></td> <td> <input type="checkbox" name="users_select[]" value="<?php echo $user['user_id']; ?>" /></td> </tr> <?php }} ?> </table> <div class="pager"> </div> </fieldset> </form> <?php } echo print_users(); ?>