This topic is locked
[SOLVED]

 Include username in email before add?

11/5/2009 4:03:33 PM
PHPRunner General questions
K
khanate author

Hello,
I am using a send email action before a new record is added. I would like to know which user submitted the info. With what variable do I add that to the email? And what variable for the edited table's name?
Also, instead of two of the fields, which are ID numbers, I'd like to send the names that are linked by the numbers. Any suggestions for that?
Thanks! I'm inept with foreach. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=13062&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

J
Jane 11/9/2009

Hi,
username of current user is in the $_SESSION["UserID"] variable, currect table name is in the $strTableName global variable. Please note you should declare this variable before:

global $strTableName;

echo $strTableName;


Also I recommend you to have a look at the list of PHPRunner session variables:

http://www.xlinesoft.com/phprunner/docs/phprunner_session_variables.htm
To replace ID with actual values select these values from lookup tables manually and then use it in your email body.

Here is just a sample:

global $dal;

$rstmp = $dal->LooupTableName->Query("LinkField=".$values["FieldName"],"");

$datatmp = db_fetch_array($rstmp);

echo $datatmp["DisplayField"];
K
khanate author 11/9/2009



Hi,
username of current user is in the $_SESSION["UserID"] variable, currect table name is in the $strTableName global variable. Please note you should declare this variable before:

global $strTableName;

echo $strTableName;


Also I recommend you to have a look at the list of PHPRunner session variables:

http://www.xlinesoft.com/phprunner/docs/phprunner_session_variables.htm
To replace ID with actual values select these values from lookup tables manually and then use it in your email body.

Here is just a sample:

global $dal;

$rstmp = $dal->LooupTableName->Query("LinkField=".$values["FieldName"],"");

$datatmp = db_fetch_array($rstmp);

echo $datatmp["DisplayField"];



Thanks, Jane. I don't understand the second code example. What do I replace? I replaced LookupTableName with the non-ID table (towns-deptos_v) and replaced FieldName with the name of the field in the ID table that contains the ID number (town) and replaced DisplayField with the non-ID table field I want to see (town-depto-name).
Thanks again!

K
khanate author 11/10/2009


global $dal;

$rstmp = $dal->LooupTableName->Query("LinkField=".$values["FieldName"],"");

$datatmp = db_fetch_array($rstmp);

echo $datatmp["DisplayField"];



Thanks, Jane. I don't understand the second code example. What do I replace? I replaced LookupTableName with the non-ID table (towns-deptos_v) and replaced FieldName with the name of the field in the ID table that contains the ID number (town) and replaced DisplayField with the non-ID table field I want to see (town-depto-name).
Thanks again!

[/quote]
I figured it out. I needed to replace LinkField as well, and I had to rename my table and fields because the dashes throw PHP off. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=45303&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' />
Thanks!