PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, January 30, 2022

[FIXED] codeigniter bootstrap modal popup

 January 30, 2022     codeigniter, twitter-bootstrap     No comments   

Issue

I have used bootstrap modal popup in my site. By clicking the button pop will open. It is working on the following code.

HTML:

<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button> 

But the button come from array.

<?php   
   $args['test'] = array(
      array(
      'type'    => 'submit',
      'id'      => ' text',
      'label'   => 'Launch demo modal',
      'desc'    => site_url('test'),
      'class'   => 'span3',
      'default' => '',
      'options' => ''),
   );

?>

How can I pass "data-toggle="modal" data-target="#myModal" in array.


Solution

Nothing different, just add those attributes in the array like this:

array(
    'type'    => 'submit',
    'id'      => ' musicfileupload',
    'label'   => 'Launch demo modal',
    'desc'    => site_url('test'),
    'class'   => 'span3',
    'default' => '',
    'options' => '',
    'data-toggle' => 'modal', // <--
    'data-target' => '#myModal' // <--
);

Update: Following is a working example:

$data = array(
    'type'    => 'submit',
    'id'      => ' musicfileupload',
    'label'   => 'Launch demo modal',
    'desc'    => site_url('test'),
    'class'   => 'span3',
    'default' => '',
    'options' => '',
    'data-toggle' => 'modal', // <--
    'data-target' => '#myModal' // <--
);
echo form_button($data);


Answered By - The Alpha
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing