|
Events are fragements of PHP code executed before or after a record
is added, edited, deleted, or when a new user registers, etc.
Here are a few examples of some common events:
-
send an email which contains the data from a new record, or shows
changes to an existing record,
-
save data in another table,
-
check record uniqueness.
Double click on the Event names to choose one of the predefined actions.
Common
parameters passed to Event Code:
$values - An
array which lists the values of fields from an Add or Edit form.
Example:
echo $values["Field1"];
$where
- A WHERE clause provides the criteria to be applied in
selecting the record to be edited or deleted
Example:
// retrieve a record to be deleted or edited
global $conn,$strTableName;
$rs = db_open("select * from ".$strTableName." where ".$where,$conn);
$data = db_fetch_array($rs);
echo $data["field1"];
echo $data["field2"];
$conn - Database
connection
$keys - An array that lists
the key columns
Example:
echo $keys["ID"];
$templatefile - Template
file name
$smarty - Smarty
object. More info about Smarty.
Example:
$smarty->assign("variable name",$value);
$smarty->assign("message",$message);
PHPRunner comes with set of handy predefined code
snippets that you can use in Events.
Sample
code snippets:
Send a simple email
Send an email with new data
Save new data in another table
Insert a record into
another table
Check to see if a
specific record exists
Display a message on
the Web page
Redirect to another page
Custom code
Here
are some actual event code:
Generate a list of
customer orders
Verify
start date is earlier than end date
Check
for related records prior to deleting a record
Speed up data entry
using events
|