• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Manage dates from a form

#1
Hi, I was wondering what was the best practice for saving a date from a form?

To save each day, month and year field individually as numerical values? 01/01/2020

I have tried many techniques, also to be able to subsequently manage them regarding a possible translation, but I do not find them practical.

You sending a form date, day, month and year, how do you manage them?
Reply

#2
Personaly, in the database I use ISO forma yyyy-MM-DD

and I use bootstrap css and bootstrap doo all the hard job. I have a smal calendar, it works fine with mobile. just

On my view I have this example

<div class="form-group row">

<span class="col-sm-2 col-form-label" >Date</span>

<div class="col-10">
<?php
if ($action == "add"){ $tfdate = date('Y-m-d');} else{$tfdate = $r['tfdate'];}
$data = array(
'name' => 'tfdate',
'type' => 'date',
'value' => $tfdate,
'style' => 'form-control'
);
echo form_input($data);
?>
</div>
</div>
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.