Skip to content
Advertisement

call a new PHP page and pass a long text

I have a PHP page(main) and would like to call another PHP page(printpage) on mouse click. I need to pass a large text.

I do not want to pass it as a url parameter as it will be too big. I guess I want to pass it as an ajax but I want to open the printpage so I can print it in the browser.

JavaScript

I am familar with the ajax statement but have not used to open a new page.

Advertisement

Answer

You can use an invisible form with a target="_blank" and method="post" and submit it, thereby sending a POST request in a new window:

JavaScript
JavaScript

Then you get the ref value in PHP as $_POST['ref']

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement