Forums

How to get user id?

calangoloco 03 Dec, 2014
Hi,

I have form to send data to database (text box and textarea box). It work. But I don't know how get user id to send to database. Anyone can help-me?

Thanks in advance.
calangoloco 03 Dec, 2014
Answer
I was like this:

Hidden field with field name equal to the field

In Setup - on load: Custom code:

<?php
$user =& JFactory::getUser();
$form->data['client_id'] = $user->id;
?>
This topic is locked and no more replies can be posted.