S
S
Sergey08082017-06-19 16:06:48
PHP
Sergey0808, 2017-06-19 16:06:48

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);

The data is transmitted exactly. But explain how to display them in the form?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2017-06-20
@AaAAxzz

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();
}

V
Vanik Khachatryan, 2017-06-20
@VaniXac

$this->view->setVar('about', $user->about);
and in html, {{ about }}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question