Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
Putting DateTime into a variable on link click

Im trying to store the datetime when a link is clicked so that later when a form is filled in, the variable is passed to a crud.php file to update information along with the time the link was clicked. Everything is working except I cannot seem to just get the datetime of the link being pressed. I've tried putting it into a for the on click and i feel it should be simple but I cannot seem to get it!

Example Link Code

<a href="http://examplelink/index.php" target="_blank" rel="noopener noreferrer" onclick="myFunction();">
<h2>Webpage One</h2>
<p>This link will open the website in a new tab. Please ensure you close this website, and not the survey website once you no longer require it.</p>
</a>

Example Script on the same .php file

<script>
function myFunction() {
  <?php
  if ($startdate == null) {
    $startdate=date('Y-m-d H:i:s');}
    ?>
}
</script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!