input->post('total_participants'); // Calculate the number of rounds $numberOfRounds = $this->calculateRounds($totalParticipants); // Pass the number of rounds to the view or store it in the database $data['numberOfRounds'] = $numberOfRounds; // Load your view with the tournament information $this->load->view('tournament_view', $data); } } // Function to calculate the number of rounds function calculateRounds($totalParticipants) { return ceil(log($totalParticipants, 2)); } ?>