Hi,
I'm trying to get the data of logged-in people into a form.
I put a custom code into the load part of my form on top of the display section:
<?php
$user =\JFactory::getUser();
$user_id= $user->get('id');
if ($user_id <> "")
{
$vollname= $user->get('name');
$nachname= trim(strrchr($vollname,' '));
$vorname= substr($vollname, 0, strlen($vollname)-strlen($nachname)-1);
$teilnehmer = $nachname .", ".$vorname;
$this->data("teilnehmer", $teilnehmer);
}
I do get the data in the way I need them, but I don't know how to put them into the form field "teilnehmer",
so I assume the last code line is not correct.
Could anybody please tell me how to get the $teilnehmer into the text field "teilnehmer" ?
Thanks in advance,
Doris
I'm trying to get the data of logged-in people into a form.
I put a custom code into the load part of my form on top of the display section:
<?php
$user =\JFactory::getUser();
$user_id= $user->get('id');
if ($user_id <> "")
{
$vollname= $user->get('name');
$nachname= trim(strrchr($vollname,' '));
$vorname= substr($vollname, 0, strlen($vollname)-strlen($nachname)-1);
$teilnehmer = $nachname .", ".$vorname;
$this->data("teilnehmer", $teilnehmer);
}
I do get the data in the way I need them, but I don't know how to put them into the form field "teilnehmer",
so I assume the last code line is not correct.
Could anybody please tell me how to get the $teilnehmer into the text field "teilnehmer" ?
Thanks in advance,
Doris
You can just use the shortcodes. In the text box under "value" put {user:name}
In PHP to set the data use $this->data("field", "value", true);
β
Or return the value you want and then in value put {var:phpname}
β
Or return the value you want and then in value put {var:phpname}
This topic is locked and no more replies can be posted.