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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:42:34+00:00 2026-06-08T07:42:34+00:00

Is it possible to open another PHP file (print_array.php) passing $array via PHP function?

  • 0

Is it possible to open another PHP file (print_array.php) passing $array via PHP function?

HTML:

<form method=post>
<input type="checkbox" name="array[]" value="111">
<input type="checkbox" name="array[]" value="222">
<input type="checkbox" name="array[]" value="333">
<button type="submit" name="action" value="print">Print</button>
<button type="submit" name="action" value="delete">Delete</button>
<button type="submit" name="action" value="add">Add New</button>
</form>

array[] is all checked, so, $array value is 111, 222, and 333.

Then, PHP function:

switch ($action) {
  case 'print': printing($_post['array']); break; /* open new window */
  case 'add': break; /* same window */
  case 'delete': break; /* same window */
  default: break;
}

function printing($array) {
  /* open print_array.php in a new window showing $array value */
}

And then, only if action=print, open print_array.php in a new window with $array value.

if (is_array($array)) {
  print_r($array);
} else {
  ...
}

The result in print_array.php would be

Array ( [0] => 111 [1] => 222 [2] => 333 )

I don’t think header(“Location: print_array.php”) can pass array value.
Is there any good way to open another PHP page in a new window passing array value?

  • 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-08T07:42:35+00:00Added an answer on June 8, 2026 at 7:42 am

    To open the window using Javascript, use window.open() when the page loads.

    To get the data to the new page, use _SESSION variables. When you get to the script with the swtich, use:

    start_session(); 
    $_SESSION['data'] = $_POST['array'];
    

    On the new window (after you use header() to get to it, use:

    start_session();
    $array = $_SESSION['data'];
    

    You will have access to the entire array in the new window.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: including php file from another server with php i want to have
Is is possible to open a text file and read the contents while another
Is it possible to open the .xlsx file on UIWebView . I can't open
Is it possible to open the same file in two separate windows in Xcode.
is it possible to open urls in BlueJ. For example in PHP I can
Is it possible to open another Window in a TabControl 's TabItem ? The
Is it possible to open another uipopovercontroller from the first popover UIButton click? If
I'm wondering if it possible to open a HTML Document to edit elements and
I want to be able to open a PowerPoint file with PHP and copy
Is it possible to open a form in MS ACCESS 2007 using a where

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.