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