My HTML page
<html>
<body>
<form action="myScript.php" method="POST">
Enter a transceiver ID:
<br><br>
<input type="text" name="id" >
<br><br>
<input type="submit" value="Submit">
</form>
</body>
My PHP script which is running on my server
<?php
$id_array = array("101");
while(1)
{
if (isset($_POST['id']))
{
$id = $_POST['id'];
echo ("ID is ".$id."\n");
array_push($transceiverID_array, $id);
}
print_r($id_array);
usleep(5000000);
// lot of processing will be done
}
?>
My PHP script is in a forever while loop. If I post some data from my HTML page, my PHP script is doing something else (which takes quite a lot of time), and not necessarily processing the line where it is checking if the variable from HTML page is set. So, even if I posted something from my HTML page, due to the long duration between posting data and the PHP script going on the isset line, my PHP script is unable to pick up data.
Is there any time limit in which I need to pick up the variable in my PHP script posted from the HTML page? Is there any better way of doing this?
Also, after posting, my HTML page, keeps waiting for my PHP script to respond. Is there any way to stop loading my HTML page?
As the other commentors asked. What is the point of having an infinite loop? The server will do the task of listen for requests in your behalf!
It is natural that the HTML page doesn't receive anything, as the flow in your PHP script never ends. Remove that loop and try the request.