I am a novice with html and PHP, but I have a fairly simple requirement. I have tried a number of different approaches, but none of them meet my needs.
The page should do the following:
- Display some text, a picture, and the date-timestamp of a file from the server (this works Display a button.
- If the user clicks the button, perform php that modifies files on the server. (This works, but see problem below)
- Refresh the page every 30 seconds (to display effects of a server process that updates the picture and date-timestamp mentioned in 1 above).
Following is what I am currently trying in g_test_02.php. The problem is that when I load the page in a browser, when it refreshes from the header, it performs the even though I have not clicked the button. I can see this viewing the files on the server.
What am I doing wrong?
Thanks
<html>
<body>
<head>
<META HTTP-EQUIV="REFRESH"
CONTENT="30">
</head>
<?PHP
Do some php to display the date-timestamp of a file on the Unix server
?>
Display some html text and a picture
<script>
function myFunction() {
<?php
Do some php to modify files on the server
?>
location.reload();
}
</script>
<button onclick="myFunction()">Verify door</button>
</body>
</html>