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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:19:20+00:00 2026-06-18T01:19:20+00:00

I made this JS function that open 2 pages function edit(id){ window.open(‘<?php echo site_url();?>store_out/store_out_print/’+id);

  • 0

I made this JS function that open 2 pages

 function edit(id){
    window.open('<?php echo site_url();?>store_out/store_out_print/'+id);
    window.open('<?php echo site_url();?>store_out/delivery_print/'+id);
    document.getElementById('print').target = '_blank';
}

I have that table that display all possible records that user can select one row and click on print image so two pages are opened:

 <?php
         for($i=0;$i<sizeof($storeout);$i++){ ?>
   <tr class="gradeZ" id="<?php echo $storeout[$i]->storeout_id;?>" onclick="edit(this.id); ">
                <td><?php printf("%06d",$i+1);?></td>
                <td><?php echo $storeout[$i]->storeout_id;?></td>
                <td><?php echo $storeout[$i]->storeout_modified_time;?></td>
                <td><?php echo $account[$i][0]->account_name;?></td>
                <td><?php echo $storeout[$i]->rof_id != 0 ? "R.O.F" : "S.O";?></td>


            </tr>
        <?php } ?>

I want when I select specific row and click on the print image, execute two functions to open two different pages (delivery/store_out).

Any Ideas guys?

  • 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-18T01:19:21+00:00Added an answer on June 18, 2026 at 1:19 am

    I’m going to assume that the td is in a tr which is programmatically generated in a loop (i.e. you will have more than 1 tr, td, and img). I will also assume jQuery is available.

    The first problem will be if you have more than 1 row that is created in a loop, you will have a bunch of things with the same id="print". This is not the good js.

    You should append the store_out (or whatever the id is you are trying to get to the controller) to the id attribute. Something like id="print_<?php echo $thing->id;?>". This will let you get the id you want to pass to the edit function. I would also add a class="print" which will make the below easier. So, the whole row would look something like:

    <td width="5%"><a id="print_<?php echo $thing->id; ?>" class="print" href="#" ><img src="<?php echo site_url();?>/images/print.png" border="0" title="Print" height="25" width="25"/> </a></td>
    

    Which would output something like:

    <td width="5%"><a id="print_1234" class="print" href="#" ><img src="http://example.com/images/print.png" border="0" title="Print" height="25" width="25"/> </a></td>
    

    Second is you are not passing the id to the method so far as I can tell. Considering you heeded the above, you can pull the id from the id attribute.

    $('.print').click(function(){
        var id = $(this).attr('id').split('_')[1];
        edit(id);
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi have made this function which is made to replicate an error that I
I made this simple function to filter the data. I add the symbols that
I've made this snippet that clicks a link after 10th second: function timeout() {
I made a fancy shape with OpenGL and I draw that shape this function:
I've made this jQuery code that toggles class to open and close. but when
Here is a simple function which i made on PHP. The problem is that
For PHP debugging I made myself a pre() function like this: function pre($data) {
I have a problem with a javascript set of functions that I made. This
I made this function to verify a user's twitter credentials. Its running on two
I made this little function from code snippets around the net. It does what

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.