Function to open new window in PHP

Asked By 10 points N/A Posted on -


Hi! I’m a beginner in PHP. I want to know any function for opening a new window using PHP codes. Could anyone give me a hint for this? Many Thanks.

Best Answer by Cyril L Edmonds
Answered By 30 points N/A #103233

Function to open new window in PHP


Hi there Noel Leal,

I understand what you'd like to achieve, but unfortunately, you can't do this using only PHP – you will need some JavaScript too. The thing is that PHP is a server-side technology, while you are trying to do something on the client side (opening pop-up window).

Here is a simple JavaScript that you can simply copy and paste into your code that will open the pop-up window using the function:

echo "
 <script type="text/javascript">
   function show(rowid, arrno) {
     return false;

Best regards,
Drake Vivian

Best Answer
Best Answer
Answered By 80 points N/A #103234

Function to open new window in PHP


Greetings Noel Leal,

I don't think it's possible to use this with PHP only.

Rather you need to use something like Javascript or jQuery to get this done.

Like on example Javascript or jQuery  

This script is good as you see there are values you can easily change for your new windows. You can set it's dimensions, does it have a scrollbar, toolbar etc. The website Techyv should be the website you want to be opened.

It is generally better not to echo your scripts from PHP. They should rather stand on their own.

I hope this solves your problem.

Answered By 30 points N/A #103235

Function to open new window in PHP


Hi New to PHP app.? Same here and that is challenging. I've been researching different forms of opening new files in PHP. Here are some ways to do: The Read-'are', the 'w' and the append 'a' From the 'r' form is read only. From the 'w' form is write only. (Will done in the beginning of the data) From the 'a' form writes also bought (well done in the end writing of the data) checked this sample form: q and if you want to read and write data just insert '+' this sign to allowed you to read and write data. sample form: $ourFileName = "testFile.txt"; $fh = fopen($ourFileName, 'X') or die("Can't open file"); fclose($fh); Good luck. Thomas

Login/Register to Answer

Related Questions