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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:48:29+00:00 2026-06-10T22:48:29+00:00

I know this is a common question but I can’t find any answer. I

  • 0

I know this is a common question but I can’t find any answer.
I have a PHP file which contains a link. When that link is clicked, I want to open another page in a new window, and on this newly opened page I want to get the ID attribute of the link clicked on the previous page.

Current page= ‘patientreg.php’
Newpage to open in new window= ‘patient_history.php’
Post data from current page to new loaded page.

Current page Code:

HTML:

<a id="37" onclick="phistory(this.id);" href="#">View history</a>  

JavaScript:

function phistory(myVar) {  
    var myurl = '../main/patient_history.php';  
    $.post(myurl,{data:myVar},function(){});  
    window.open(myurl,'_blank');                
} 

New page code:

$phid = $_REQUEST["data"];  
echo phid;

The problem is that it is not echoing the data on the next page, but I can see echo with the full new page in the Firebug response tab of the current page.

  • 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-10T22:48:30+00:00Added an answer on June 10, 2026 at 10:48 pm

    try this, so using a form to send data to your page, and you can have more verbose the anchor element:

    HTML:

    <form id="myform" action="../main/patient_history.php" method="POST">
       <input type="hidden" name="data" id="data" />
    </form> 
    
    
    <a data-idref="37" class="see-history" href="#">View Histroy</a>
    

    Javascript:

    $(function() {
    
       $('.see-history').bind('click', function(event) {
          try { 
             window.open('about:blank', 'mynewwindow');   
             $('#myform').find('#data').val($(this).data('idref'));
             $('#myform').attr('target', 'mynewwindow').submit();
          } catch(e) {}
    
          return false;
    
       });
    
    });
    

    Edit

    if you need to open a new window for each story, you can create a new window with the name of the element id:

       $('.see-history').bind('click', function(event) {
          var id = $(this).data('idref');  
          try { 
             window.open('about:blank', 'mynewwindow_' + id);   
             $('#myform').find('#data').val(id);
             $('#myform').attr('target', 'mynewwindow_' + id).submit();
          } catch(e) {}
    
          return false;
    
       });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this may be a common question but I can't find the exact
I know this is an old question, but I have spend any hours on
I have a file named common.cs which contains commonly used functions like this public
I know this might be a common question but I have tried to search
First, I know this is kind of common question, but I could not find
I know this is a common question but I just can't seem to get
I know regex and substrings is a common question on here but i can
Okay, I know this is a common enough question, but all the solutions I've
sorry, I know this question might be too common, but I really couldn't figure
I know this is probably a common and easily answered question, but I'm a

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.