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

  • Home
  • SEARCH
  • 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 8419873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:44:09+00:00 2026-06-10T02:44:09+00:00

I am trying to post the $GLABALS variable to another php file and get

  • 0

I am trying to post the $GLABALS variable to another php file and get it to open in a popup and load the printOnly.php file with the value of the $GLOBLAS variable (which passes the name of the xml file used by $dom.

Currently it opens the popup but cannot find the value of the variable posted but it also loads the variable into the existing navigator window where the value of the posted variable is retrieved without a problem. I want the main window to stay on the original php page and only load the file called in the form to the popup.

On the original page I have:

<form name ="printView" method ="post" action="printOnly.php" target="popUp" >
    <input type="hidden" name="toPopFile" value="'.$GLOBALS["file"].'" />
    <input type="image" value="submit"  class="button" title="print view" src="graphics/printview.png" align="middle" onclick="javascript:viewClick(\'printOnly.php\')" />
</form>

In the file to be loaded into the popup I have:

$file=basename($_POST['toPopFile']); // value to be retrieved which is the name of the xml file currently loaded in original php file

$dom = new domDocument;
if (file_exists($file)) {
    $dom->load($file);
    } else {
    exit('Error ! xml file not found.');
}

And here is the javascript function being called from an external .js file

var view;
function viewClick(url) {
  view= window.open(url,'view text','menubar=yes,scrollbars=yes,resizable=yes,width=640,height=700');
  view.focus();
}

Help! (and keep it simple, I can parrot well, but I don’t always understand what I’m doing)

  • 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-10T02:44:11+00:00Added an answer on June 10, 2026 at 2:44 am

    Your form is using a POST method already, so I will start with that. It means using your submit button as a real HTML submit button (ie drop the onclick event). Then add a onsubmit handler to your post:

    <form name="printView" method ="post" action="printOnly.php" target="popUp" onsubmit="popup(this);">
    

    Add this function in your Javascript to create the popup, and then submit the form to it:

    function popup(form) {
        window.open('', 'formpopup', 'view text','menubar=yes,scrollbars=yes,resizable=yes,width=640,height=700');
        form.target = 'formpopup';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying post a javascript array using jquery $.post method to php and use
I'm trying to POST the entire HTML for a dynamic table to another page
I'm trying to post data with jQuery in an asp.net application to a popup.
I'm trying to post images from my android application to php Wampserver. The server
I am trying to post a sound to echo nest for file analysis. The
Trying to post a status update using facebook php sdk. Code posted below. As
i am trying to post a form to php that contains multiple identical fields
Trying to post to a fan page, I get this: {error:{type:OAuthException,message:A user access token
I am trying to POST a HTML (contained in a file) to a URL
I am trying to post an array full of checkboxes and to open it

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.