I'm trying to display an alert message on my main page which is index.php. I use a second file to insert the amount of times the button has been pressed. But the user should only be able to vote every 5 minutes. It should display them an alert message if the vote failed or succeeded.
Right now it always displays both buttons on the index.php.
Index.php
<html>
<body>
<!-- ** PHP ** -->
<?php
include_once 'resources/method.php';
?>
<!-- ** HTML ** -->
<form id="button1" action="resources/method.php" method="post">
<input type="submit" value="VOTE"/>
</form>
</body>
</html>
method.php
<?php
// if (5mins passed) {
// } elseif (time <= 5mins) {
// insert query;
// }
// if (5mins passed) {
?>
<div class="alert">
Wait 5mins
</div>
<?php
// } else {
?>
<div class="alert">
Success!
</div>
<?php
// }
?>
<?php
header ( 'Refresh: 5; URL=/project/index.php' );
?>
Here's the fiddle to what I'm currently stuck with. Fiddle (Its not really necessary)
It should only display the "Wait 5mins" button when 5 minutes have not passed yet and the "Success!" button should be displayed when 5 minutes have passed. If the user did not click the "Vote" button none of them should be displayed.