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 9060619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:16:35+00:00 2026-06-16T15:16:35+00:00

I am pretty new to Codeigniter and aiming to follow best practice as I

  • 0

I am pretty new to Codeigniter and aiming to follow best practice as I learn. Currently I have a table that is generated via DB

HTML Table

<tr>
    <td>
      <a class="galName" href="#myModal" data-toggle="modal" >
        <?php echo $gal['name']; ?>
      </a>
    </td>
    <td>
      <?php echo $gal['clientName']; ?>
    </td>
</tr>
<?php endforeach; ?>

The Modal

<div class="modal fade hide modal-creator" id="myModal" style="display: none;" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <h3>Edit Gallery</h3>
    </div>
    <div class="modal-body"><?php echo form_open('url'); ?>

    <div class="row">
        <div class="span5">
            <?php print_r($galleryName); ?>
            <div class="control-group">
                <?php
                    $galleryName = array(
                        'id'            => 'galleryName',
                        'name'          => 'galleryName',
                        'placeholder'   => 'Gallery Name',
                        'required'      => 'required',
                    );
                    echo form_label('Gallery Name:', 'galleryName');
                    echo form_input($galleryName);
                ?>
            </div><!-- /control-group -->
       </div><!--/span5-->
   </div><!--/row-->
</div><!-- /modal-body -->

<div class="modal-footer">
    <!-- <p class="span3 resize">The following images are sized incorrectly. Click to edit</p> -->
    <a href="javascript:;" class="btn" data-dismiss="modal">Close</a>
    <a href="javascript:;" class="btn btn-primary">Next</a>
</div>

The link calls a bootstrap modal where I want to pass the data for the selected gallery. I know that I can pass the data via jQuery, but is it possible to keep this modal in the MVC framework and if yes how does one go about calling the controller via the modal link?

Thanks so much on the help, and would be happy to accept any suggestions on resources for CodeIgniter. I am currently working through the Nettuts videos, though they are dated,and also working through the user guide.

  • 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-06-16T15:16:36+00:00Added an answer on June 16, 2026 at 3:16 pm

    i really think you are misunderstanding what modal is and what a controller is, you can’t do this without ajax call: how does one go about calling the controller via the modal link

    what i usually do is to create a view/modals/ folder then put there all my bootstrap modals so for example:

    application/views/modals/my_modal_form.php
    

    and that will looks as you shown, inside:

    <div class="modal fade hide modal-creator" id="myModal" style="display: none;" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">×</button>
            <h3>Edit Gallery</h3>
        </div>
        <div class="modal-body"><?php echo form_open('url'); ?>
    
        <div class="row">
            <div class="span5">
                <?php print_r($galleryName); ?>
                <div class="control-group">
                    <?php
                        $galleryName = array(
                            'id'            => 'galleryName',
                            'name'          => 'galleryName',
                            'placeholder'   => 'Gallery Name',
                            'required'      => 'required',
                        );
                        echo form_label('Gallery Name:', 'galleryName');
                        echo form_input($galleryName);
                    ?>
                </div><!-- /control-group -->
           </div><!--/span5-->
       </div><!--/row-->
    </div><!-- /modal-body -->
    
    <div class="modal-footer">
        <!-- <p class="span3 resize">The following images are sized incorrectly. Click to edit</p> -->
        <a href="javascript:;" class="btn" data-dismiss="modal">Close</a>
        <a href="javascript:;" class="btn btn-primary">Next</a>
    </div>
    

    so when i need that single modal i just load it inside the main controller view i want to show up that modal doing simply:

        <body>
        <?php echo $this->load->view('modals/my_modal_form'); ?>
    
        <tr>
        <td>
          <a class="galName" href="#myModal" data-toggle="modal" >
            <?php echo $gal['name']; ?>
          </a>
        </td>
        <td>
          <?php echo $gal['clientName']; ?>
        </td>
    </tr>
    <?php endforeach; ?>
        </body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to code igniter. Is there best practice for serving different view
Pretty new to jquery/javascript, but proficient in html/css... I have a list of siblings
Pretty new to threading and I have this QList that the threads share between
I have a new site that I am currently in the process of mapping
Im pretty new to Dreamweaver. Im having a problem. I have a website that
Pretty new to MVC and the like. I have a class the looks like
I'm still pretty new to ObjC. I noticed that it's pretty standard everywhere to
I am planning to develop a pretty awesome new web app that has a
Im pretty new to REST but as far as i have gathered i understand
hi i am currently learning code igniter i am pretty much new to this

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.