Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7488199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T14:47:17+00:00 2026-05-29T14:47:17+00:00

On my site, users can create teams (clans) and invite other users to join

  • 0

On my site, users can create teams (clans) and invite other users to join them.

I’m working on a page at the moment where team leaders can edit the “ranks” of each user in the team. These options are Founder, Captain, Member, Inactive and Kick (which will remove the user from the team altogether).

I’ve included a quick screenshot of how the page looks to help explain what I’m hoping to achieve.

http://cl.ly/E9Gb

So team leaders can go through and change the rank of each user and then hit update.

What would be the best way to go about this?

Here are some extracts from my code at present:

CONTROLLER:

if ($this->input->post('update_roster'))

{

    $member_id = $this->input->post('user_id');
    $member_rank = $this->input->post('member_rank');
    $this->clan_model->update_roster($clan_id, $member_id, $member_rank);

}

MODEL:

public function update_roster($clan_id, $user_id, $rank)

{

    $data = array(

       'rank' => $rank

    );

    $this->db->where('clan_id', $clan_id);
    $this->db->where('user_id', $user_id);

    if ($this->db->update('clan_joined', $data))

    {

        return TRUE;

    }

}

VIEW:

<h3>Roster</h3>

<?php

$member_rank = array(
    '1' => 'Founder',
    '2' => 'Captain',
    '3' => 'Member',
    '4' => 'Inactive',
    '5' => 'Kick'
);

?>

<?php $attributes = array('id' => 'update_roster', 'class' => 'nice'); ?>

<?php echo form_open('clan/manage/' . $this->uri->segment(3) . '#roster', $attributes); ?>

<table width="100%">

<thead>

    <tr>
        <th class="text-center">#</th>
        <th>Username</th>
        <th>Rank</th>
    </tr>

</thead>

<?php form_open('clan/manage/' . $this->uri->segment(3) . '#roster', $attributes); ?>
<?php foreach ($members AS $member) : ?>
<tr>
    <td class="text-center"><a href="<?php echo site_url('people') . '/' . $member->username; ?>"><?php echo avatar(32, $member->username, $member->avatar_uploaded); ?></a></td>
    <td><?php echo $info->clan_tag; ?> / <?php echo $member->username; ?></td>
    <td><?php echo form_dropdown('member_rank', $member_rank, $member->rank); ?></td>
</tr>
<?php echo form_hidden('user_id', $member->username); ?>
<?php endforeach; ?>

</table>

<?php echo form_submit('update_roster', 'Update'); ?>
<?php echo form_close(); ?>

I understand this code is wrong, as it’s not working, but thought I would share what I have done so far.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T14:47:20+00:00Added an answer on May 29, 2026 at 2:47 pm

    On your HTML form change the dropdown and your hidden input to be arrays:

    <td><?php echo form_dropdown('member_rank[]', $member_rank, $member->rank); ?></td>
    

    and

    <?php echo form_hidden('user_id[]', $member->username); ?>
    

    Then $this->input->post(‘member_rank’) and ‘user_id’ will each receive an array. You can loop through the arrays in PHP and call the UPDATE code for each iteration of the loop:

    for ($i = 0; $i < count($member_id); $i++) {
        $current_member_id = $member_id[$i];
        $current_member_rank = $member_rank[$i];
        // Call your update code.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a social site where users can block other users. Throughout
I'm building a site wherein users can create accounts and message each other using
I succeeded to create a register form, and now users can register my site.
I have created a page on my site where users can post directly to
I am working on a site where users can login to get more private
I'm creating a site where users can create photo albums, create events, upload videos
For my site, I've created a search page where users can search for the
Im making my little site where users can create blogs, and have studied publishing
I have a site where users can post stuff (as in forums, comments, etc)
I have a site where users can log in and check on outstanding support

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.