title: PHP: open another PHP with array value
body: <p>Is it possible to open another PHP file (print_array.php) passing $array via PHP function?</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form method=post&gt;
  &lt;input type="checkbox" name="array[]" value="111"&gt;
  &lt;input type="checkbox" name="array[]" value="222"&gt;
  &lt;input type="checkbox" name="array[]" value="333"&gt;
  &lt;button type="submit" name="action" value="print"&gt;Print&lt;/button&gt;
  &lt;button type="submit" name="action" value="delete"&gt;Delete&lt;/button&gt;
  &lt;button type="submit" name="action" value="add"&gt;Add New&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>array[] is all checked, so, $array value is 111, 222, and 333.</p>
  
  <p>Then, PHP function:</p>
  
  <pre><code>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 */
  }
  </code></pre>
  
  <p>And then, only if action=print, open print_array.php in a new window with $array value.</p>
  
  <pre><code>if (is_array($array)) {
    print_r($array);
  } else {
    ...
  }
  </code></pre>
  
  <p>The result in print_array.php would be</p>
  
  <pre><code>Array ( [0] =&gt; 111 [1] =&gt; 222 [2] =&gt; 333 )
  </code></pre>
  
  <p>I don't think <strong>header("Location: print_array.php")</strong> can pass array value.
  Is there any good way to open another PHP page in a new window passing array value?</p>