Forum Moderators: open

Message Too Old, No Replies

How to call a server-side script

without changing the browser window

         

david752

12:39 am on Mar 21, 2002 (gmt 0)

10+ Year Member



I would like to call a PHP page or a CGI script by URI from a currently-displayed Web page.

The normal model is that such a call will return a Web page (MIME type text/html) that the client browser will then display.

However, I want the current browser page to remain unchanged. I want to run the server-side script for its side effects, not its standard output.

An example would be attaching a Javascript event to a form button. When the user clicks the button, a "location.href=mycounter.php" statement is executed. mycounter.php would contain PHP code to increment a number stored in a file on the server. The page showing the form doesn't even flicker when the user clicks the button, but the click is counted.

David

Duckula

2:31 am on Mar 21, 2002 (gmt 0)

10+ Year Member



Use server side includes.

<!--#exec cgi="filename.cgi"-->

where filename.cgi doesn't produce any output.