Answer the question
In order to leave comments, you need to log in
Php Phalcon how to edit user information?
I want to edit user information, how can I display this in the form.
Tried like this:
$user = Users::findFirst($this->session->get("auth-id"));
Tag::displayTo("about", $user->about);
Answer the question
In order to leave comments, you need to log in
What is your form? Do you mean component or just html ?
If you are working with a component, the general code might look like this
use Phalcon\Forms\Form;
use Phalcon\Forms\Element\Text;
// форма
$user = Users::findFirst($this->session->get("auth-id"));
$form = new Form($user);
$form->add(new Text('about'));
// вывод
<?php echo $form->render('about'); ?>
// сохранение, например
$form->bind($_POST, $user);
if ($form->isValid())
{
$user->save();
}
$this->view->setVar('about', $user->about);
and in html, {{ about }}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question