1

I've searched extensively on the web about how to handle pop-up windows in PHP without finding any useful info. There is a bit for VBA but not really portable to PHP.

After I modify one or more fields and submit the web page to be saved, this pop-up appears with the OK button to click on that completes the saving process.

Is there a way to handle it via a PHP script?

Nev
  • 1,529
  • 21
  • 18

3 Answers3

4

PHP is a server side language. Any popup on your webpage is probably done with Javascript, which is a client side language (well, at least in this context it is). So no, there's no way to handle this with only PHP.

ciruvan
  • 5,143
  • 1
  • 26
  • 32
  • When you say "only" do you mean that "PHP+something else" would be able to handle it? like what, for instance? – Robert Shoferbridge Aug 16 '13 at 09:54
  • PHP creates the page and the output is sent to the user viewing your page. After that moment, PHP is out of the game. You would need to use Javascript to open a popup after the page has finished loading or later. – ciruvan Aug 16 '13 at 09:58
  • I know the cookie from the PHP session. Would that be enough to pass to javascript to get hold of the OK page? – Robert Shoferbridge Aug 16 '13 at 10:14
  • You could pass values directly to Javascript from PHP as well. Check [this](http://stackoverflow.com/questions/10437703/pass-php-variable-value-to-javascript). – ciruvan Aug 16 '13 at 10:16
1

you can do it with javascript

onclick="centerPopUp('abc.php','windowname1','width=1000, height=1000'); return false;"
<script>
function centerPopUp( url, name, width, height, scrollbars ) { 
str = "";
str += "scrollbars=1,";
str += "width=" + width + ","; 
str += "height=" + height + ",";
str += "resizable=0,"; 
str += "scrollbars=" + scrollbars + ","; 
str += "width=" + width + ","; 
str += "height=" + height + ",";*/
window.open( url, name, str ); 
}
</script>
chirag ode
  • 950
  • 7
  • 15
  • I'm running the PHP script on a Linux machine. The script emulates the action of an operator on a client machine. – Robert Shoferbridge Aug 16 '13 at 09:59
  • I'm running the PHP script on a Linux machine. The script emulates the action of an operator on a client machine. Then there is the problem that I don't know the URL of that page. I'm now using wireshark to find it out. – Robert Shoferbridge Aug 16 '13 at 10:04
0

You can use Use jquery, AJAX, javascript to achieve the requited functionality. Pure PHP Will not able to do this stuff.

arslaan ejaz
  • 1,001
  • 13
  • 31
  • The script runs on a Linux server and emulates an operator's actions. I didn't know I could insert javascript in PHP script. – Robert Shoferbridge Aug 16 '13 at 10:02
  • @Robert Shoferbridge You can embedded PHP code in html very easily, and yes you can insert javascript in .php file that will work fine, just like it will work with .html. – arslaan ejaz Aug 16 '13 at 10:11
  • The problem is, I don't know how to get hold of the OK page. How to identify it amongst the exchanged packets and how to direct to it the "OK clicked" instructions. Any suggestion? – Robert Shoferbridge Aug 16 '13 at 10:20