I am a bit puzzled with this one. I am trying to display a "Please wait..." message when a form is submitted (see code below) that is running PHP on the same page. It appears to run the PHP and then reloads the page.
I have added the sleep(10) just for testing purposes.
Can anyone help?
Thanks,
John
EDIT: Ok, I now understand the difference between server and client side. So - my question is: How do I display a message when the submit is clicked and before the PHP is run?
<?php
if (isset($_POST['submit'])) {
echo "Please wait..."; //display a loading message
}
?>
<form action="test.php" method="post">
<input type="test"></input>
<button name="submit" type="submit">SEND</button>
</form>
<?php
if (isset($_POST['submit'])) {
sleep(10); //run a script that takes a while
}
?>