Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get the current datetime in php when button is clicked

<h2>Click</h2>
<form action="" method="POST">
    <button name="click" class="click">Click me!</button>
</form>

<?php
if(isset($_POST['click']))
{
    $date_clicked = date('Y-m-d H:i:s');
    echo "Time the button was clicked: " . $date_clicked . "<br>";
}
?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #current #datetime #php #button #clicked
ADD COMMENT
Topic
Name
3+1 =