Data type edit input - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Data type edit input (/showthread.php?tid=76287) |
Data type edit input - Marcolino92 - 04-30-2020 Hi, having to edit an article already present, I come across the field composed of an input data. PHP Code: <div class="form-group mb-3 row"> Taking the current value (therefore a date and a date type field) unfortunately I do not take the date that I saved in the database in "strtotime" format. PHP Code: 'birth' => strtotime(str_replace('/','-',$this->request->getVar('birth'))), How can I do? RE: Data type edit input - php_rocs - 04-30-2020 @Marcolino92, Are you asking how to convert the date from your input field into a date that can be saved in the database? RE: Data type edit input - Marcolino92 - 05-01-2020 I was looking for a way to trace an input date, the date saved in the database in strtotime(). I solved it like this: PHP Code: <div class="form-group mb-3 row"> But now with the same speech, I can not show the category already present referred to a post, selected. I don't know how to explain it better, but imagine that you are editing a post and want to show yourself selected from a list, the category to which it belongs. PHP Code: <?php if (!empty($categories) && is_array($categories)) : ?> I tried this, but it doesn't work (it shows the selected only after choosing a category and keeps it, but I want it to show me initially selected the category in which it is already present.) RE: Data type edit input - php_rocs - 05-01-2020 @Marcolino92, I don't know if I understand what you are asking but I'm wondering if you can have the model pull the category related to the specific record and if it doesn't exist then use a default category value. |