{imageverification} Post edited by: beadsboy, at: 2007/06/09 15:41"> how to insert logged in user details like username - Forums

Forums

how to insert logged in user details like username

beadsboy 09 Jun, 2007
Hello,

I have just now made a simple form. But i want to insert the username and email id of the user already logged in into the form either as label or as hidden text... anyway but i want it emailed into the results.

Below is the code i put into chronoengine.

Thankyou in advance,

Devang
Mumbai, India.

<form id="free_teletherapy" name="free_teletherapy" method="post" action="">
<label>Name
<input name="name" type="text" id="name" />
</label>
<label> Surname
<input type="text" name="surname" id="surname" />
</label>
<p>
<label>Birth Date
<select name="date" id="date">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>30</option>
<option>31</option>
</select>
</label>
<label>Month
<select name="month" id="month">
<option>Jan</option>
<option>Feb</option>
<option>Mar</option>
<option>Apr</option>
<option>May</option>
<option>Jun</option>
<option>Jul</option>
<option>Aug</option>
<option>Sep</option>
<option>Oct</option>
<option>Nov</option>
<option>Dec</option>
</select>
</label>
<label>Year
<input name="year" type="text" id="year" size="4" maxlength="4" />
</label>
</p>
<p>
<label>Sex
<select name="sex" id="sex">
<option>Male</option>
<option>Female</option>
</select>
</label>
</p>
<p>
<label>Place of Birth :<br />
City
<input name="birthcity" type="text" id="birthcity" size="30" />
</label>
</p>
<p>
<label>State
<input name="birthstate" type="text" id="birthstate" size="30" />
</label>
</p>
<p>
<label>Country
<input name="countrybirth" type="text" id="countrybirth" size="30" />
</label>
</p>
<p></p>
<p>
<label>Brief History of Health Problem
<textarea name="history" cols="70" rows="5" wrap="virtual" id="history"></textarea>
</label>
</p>
<p>
<label>Present Health Symptons
<textarea name="presentsymptons" id="presentsymptons" cols="70" rows="5"></textarea>
</label>
</p>
<p>
<label>Present Location of Patient
<input name="patientlocation" type="text" id="patientlocation" size="30" />
</label>
</p>
<p>
<label>Email
<input type="text" name="email" id="email" />
</label>
</p>
<p>
<input name="emailsubject" type="hidden" id="emailsubject" value="Your Free Teletherapy Form Submission at <!-- w --><a class="postlink" href="http://www.com">www.com</a><!-- w -->" />
<input name="fromemail" type="hidden" id="fromemail" value="abd@abd.org" />
<input name="fromname" type="hidden" id="fromname" value="abc" />
</p>
{imageverification}
<p>
<label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label>
</p>
</form><br><br>Post edited by: beadsboy, at: 2007/06/09 15:41
Max_admin 09 Jun, 2007
Hi,

Wherever you want to put the current user username or email, use this :
username:
<?php echo $my->username; ?>



email :

<?php echo $my->email; ?>


unique userid at the database :

<?php echo $my->id; ?>


Cheers

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
GreyHead 10 Jun, 2007
Hi beadsboy,

What shows up in the html is
<form . . . >
<table...>
  <tr>
    <td>
      <input id="name" type="text" chronoform="" value=" 
    </td>
  </tr>
</table>
</form>
The input line cuts off after the 'value="' What was in there in your form html?

I think the code should be something like:
<?php global $my; ?>
<input type="text" name="name" value="<?php echo $my->username; ?>" />
<input type="text" name="email" value="<?php echo $my->email; ?>" />
<input type="submit" name="submit" value="Submit" />


Bob
beadsboy 10 Jun, 2007
Hello Bob,

Thanks a ton ..

its started ...

Thankyou,

Devang
beadsboy 10 Jun, 2007
Hello Bob,

Thanks a ton ..

its started ...

Thankyou,

Devang
beadsboy 10 Jun, 2007
Hello Bob,

Thanks a ton ..

its started ...

Thankyou,

Devang
Max_admin 14 Jul, 2007
Hi CD,

You can do this using a very simply SQL statement and run it at the top of your HTML, at the top of your HTML add this code :


<?php
global $database,$my;
if($my){
$database->setquery("SELECT * FROM #__yourtablename WHERE user_id = '".$my->id."'"«»);
$rows = $database->loadObjectlist;//now $rows is a list of results!!e.g:$rows[0]->username
}
?>
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
desertbabe 02 Dec, 2008
Hello - saw you were online and thought I'd ask for advise. I am new to coding and would like to insert the [info] below from my joomla databases automatically. But I don't have a clue...

Submission Notifications
Notify Email
Subject: [username] has signed up for [title]
Body: [username] has signed up for [title] on [dates]. Please contact them with further details.
Confirmation Email
Subject: Thank you for registering for [title]
Body: Please feel free to contact me at {phone number} or at {email} for more information. I will contact all event attendees {the week, day} before the event with further instructions and information. Please remember to keep an eye on the website event listing [Event ID] for any changes.

Waitling List Notifications
Notify On Waiting List
Subject: [username] has registered on your waiting list
Body: [username] has signed up for [title] on [dates] and is currently on the waiting list. Please contact them with further details.
Notify Off Waiting List
Subject: [username] has unregistered for [title]
Body: [username] has unregistered for [title] and has been removed from the waiting list. Please confirm with them as soon as possible.

The component I am using is RedEvent. Thanks DB 😶
GreyHead 02 Dec, 2008
Hi desertbabe,

If you are using redEvent then wouldn't it be simpler to use RedForm with it? I'm sure you could use ChronoForms but it may not be a straightforward task for a new coder.

Bob
desertbabe 03 Dec, 2008
Hi 😶 yes, I suppose that would work. I am using RedForm for event registration.

Just to make sure that I understand correctly - if I create a form to "insert" into the email it should automatically include all the data I need in the email notification ??

How do I get the form into the email, copy the {redform}formnumber{/redform} into the email?

Funny, some programming issues I can get and solve in a minute - this one has me stumped. Sorry to be so dense. Ellie
GreyHead 03 Dec, 2008
Hi Ellie,

If you create a form; create a valid, enabled email block and enable emails in the General tab (there's a tutorial in the DownLoads section that steps through this), then ChronoFroms will create a default email template with all your form info in it. The template is good for text and text area fields but needs editing for checkbox and radio groups. You may anyhow find that it doesn't suit your style but at least you have a template to work from.

I'm not sure what you mean by 'getting the form in the email'? ChronoForms creats forms for Joomla pages - it might be possible to get one into an email but this isn't a built-in feature.

Bob
desertbabe 03 Dec, 2008
Hi Bob
Thanks for the advise. I have downloaded Chronoforms and will see what I can do. If I get stuck, I'll see you back here in a couple of days. 😲
Ellie
This topic is locked and no more replies can be posted.