0

I am working on something here, I have a button, when you click on this button I want another page to open in a new window and not a new tab.

How would I do this in codeigniter?

I have a function in my controller like so

function print_members(){
        $this->load->model('common_model');
        $data = $this->common_model->general();
        $data['members'] = $this->common_model->all_members();
        $this->load->view('print_members', $data);
    }

and when the user clicks on my input button

<?php echo form_open('controller/print_members', array('id'=>'form', 'target' =>'_blank')); ?> 
            <input id="print" type="submit" name="print" value="Print"/>
            <? echo form_close(); ?>

I am basically looking for away to open `controller/print_members' function in a new window. The following code aboves opens it in a new tab.

user1269625
  • 3,121
  • 26
  • 79
  • 111
  • Pretty much duplicate http://stackoverflow.com/questions/2541392/opening-new-window-in-html-for-target-blank – jtheman Jan 25 '13 at 19:28

1 Answers1

0

This can be done by javascript

Javascript

<script>
function popup(){
var xhr = "<?php echo base_url('print_members')?>" /***controller url****/
popup=window.open(xhr,'print members' 'width=500,height=500');
}
</script>

you can used input or href like this

   <input id="print" type="button" name="print" value="Print" onclick="popup()"/>

Or

 <a href="void:javascript" onclick="popup()"/>Print </a>

no change in controller file

shafiq.rst
  • 1,286
  • 1
  • 12
  • 26