Reputation: 23
How to assign default value current time stamp to an input field.
Then I want to insert into db as hidden.
How can I assign a default value (current taimestamp)?
<input name="status" id="status" type="hidden"
value="<?php echo CURRENT_TIMESTAMP ?>"/>
Upvotes: 0
Views: 5068
Reputation: 6463
You could do it in the backend, just by using a default value
to the table column.
UPDATE <table_name> SET <column_name> = NOW();
Upvotes: 0
Reputation: 745
Use value= <?php echo date('Y-m-d H:i:s'); ?>
Set the date format as per your need.
Upvotes: 3