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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:24:57+00:00 2026-06-12T05:24:57+00:00

I read many posts but i couldn’t find an answer to my question. I

  • 0

I read many posts but i couldn’t find an answer to my question. I have a button on a webpage which is linked to a controller. This controller prepares some data and calls the view. In the view I have a php variable with this data.

I want to open a new page/tab and add the content of my php variable. The content of the variable is a SVG string which is readable by all browsers.

I know this is not possible in php. I need to use JavaScript, but how can i add the content of a php variable to a new tab???

Note: I have the string only in the php variable not in a file and I don’t want to click again on a link to open a new tab.

Any ideas or solutions?

According to the first answer an example (doesnt work:()

<html>
<head>
    <title>
        Test file
    </title>
    <script>
        var myWindow = window.open('','_newtab');
        myWindow.document.write($('myString').text());

    </script>
</head>
<body>
    <p style="display:none" id="myString">Das kommt auch auf die neue seite</p>
</body>

  • 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-12T05:24:59+00:00Added an answer on June 12, 2026 at 5:24 am

    PHP is not capable of doing that. You need Javascript. Or you define your button with target blank.

    Window open() Method http://www.w3schools.com/jsref/met_win_open.asp

    HTML target Attribute http://www.w3schools.com/tags/att_a_target.asp

    JS example:

    $(document).ready(function(){
        myWindow=window.open('', '_blank')
        myWindow.document.write($('#myString').text());
    });
    

    This will open a new window and write #myString content to it. You need to define #myString with your string or whatever you want to display. E.g.

    <p id="myString">New window</p>
    

    Here you go http://jsfiddle.net/qBjVG/13/

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

Sidebar

Related Questions

I've been through the forums and read many posts relating to my question, but
I have read many posts on Session-scoped data in MVC, but I am still
I read many threads in stackoverflow and also googled but i still have one
I have read many question about improving the performance of C++ and C code
I have read many questions about Android, J2ME and RecordStore , but I still
I have read many questions about the facebook login but until not I didnt
I know this question has been asked many times, but I couldn't manage to
I have read many posts about how to specify the foreign key name in
read many posts about the difference between the 3 idioms. But got more confused,
I have read Apple's documentation and as many posts as I could here on

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.