Data type edit input |
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?
@Marcolino92,
Are you asking how to convert the date from your input field into a date that can be saved in the database?
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.)
@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. |
Welcome Guest, Not a member yet? Register Sign In |