How to correctly get the user_id of the logged in Joomla user and display it in chronoform for saving into database? I am noob to this. Please excuse me. Below is the code I use and I knew there are errors in it because the user id won't appear in the form:
Attached is the result of the form.
<?php
$user =& JFactory::getUser();
$form->data['email'] = $user->email;
$form->data['name'] = $user->name;
$form->data['user_id'] = $user->id;
?>
<div class="ccms_form_element label_over" id="name_container_div" style="">
<label for="name" size="250">Name</label>
<input id="name" value="<?php echo $name; ?>" name="name"
type="text" <?php echo $readonly; ?> />
</div>
<div class="ccms_form_element label_over" id="name_container_div" style="">
<label for="email" size="250">Email</label>
<input id="email" value="<?php echo $email; ?>" name="email"
type="text" <?php echo $readonly; ?> />
</div>
<div class="ccms_form_element label_over" id="name_container_div" style="">
<label for="user_id" size="100">User Id</label>
<input id="user_id" value="<?php echo $id; ?>" name="id"
type="integer" <?php echo $readonly; ?> />
</div>
Attached is the result of the form.