June 15, 2010

Monitoring for postbacks with PHP?

Question by Rebecca

I have a PHP page with content that my users can view. When this page receives a POST request from a certain external URL, I’d like to redirect the user to another page.

The problems I’m’ having are:

How can I monitor the page for requests being sent in an efficient way?

How can I actually redirect them since header() doesn’t work.

Thanks.

Answer by Starx

we can put this snippet to check the post request

if($_POST['flag']==1) {
          header("location:newpage.php");
          exit();
}

But If you want to check the request regularly without user interaction than you will have to use AJAX

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!