Forums

Hidden form field to make timestamp

driv 05 Sep, 2016
Hello,
I'm migrating a form to Chronoforms and one of the fields has a timestamp in it...

value="<?php echo date("Y-m-d G:H:s"); ?>"


How can I use a hidden form field to do this?

Thanks.
GreyHead 05 Sep, 2016
Answer
1 Likes
Hi driv,

You could use a Custom Code element to add a hidden input
<input type='hidden' name='timestamp' id='timestamp' value='<?php echo date("Y-m-d G:H:s"); ?>' /> 
but it might be more useful to add the timestamp after the form is submitted with a Custom Code action in the On Submit event
<?php
$form->data['timestamp'] = date("Y-m-d G:H:s");
?>

Bob
driv 05 Sep, 2016
That's great. I went with the second option.

Thanks again Bob!
This topic is locked and no more replies can be posted.