Thank you Ben, the code below update the database. The problem now is to use the pre-parser to send emails to students, base on the response code. I will be working on this now. Any help on how to use the preparser to do this will be appreciate.
The form has been finalised, prior to updating with this code, which was a response from the payment gateway. So I want to use the update in the preparser to send the emails each time the responses are inserted or altered.
Ben, thank you for the encouragement. Should I remove this sql code now "mysql_query($query) or die(mysql_error()); "
<?php
$hostname = "myhost.com";
$username="myusername";
$password="mypassword";
$dbname="mydatabasename";
$usertable="mytable";
mysql_connect($hostname,$username,$password);
mysql_select_db("mydatabase") or die("Could not select database");
if(isset($_POST['ce_transref']))
{
$ce_res['C00'] = "Transaction successful.";
$ce_res['C01'] = "Transaction cancelled. ";
$ce_res['C02'] = "Transaction cancelled by inactivity.";
$ce_res['C03'] = "Transaction aborted by user.";
// the following are the parameters returned by $_POST
$ceresponse = strtoupper($_POST['ce_response']);
$cetransref = $_POST['ce_transref'];
$ceamt = $_POST['ce_amount'];
$cedata = $_POST['ce_data'];
$cememo = $_POST['ce_memo'];
//echo $cedata;
//print_r ($ceresponse);
if($cedata=='mycode)
{
$query="UPDATE ft_form_99 SET ce_response= '$ceresponse', ce_transref= '$cetransref', ce_amount= '$ceamt', ce_data= '$cedata', ce_memo='$cememo' WHERE cetransref= '$cetransref'";
mysql_query($query);
//mysql_close();
mysql_query($query) or die(mysql_error());
}
else
{
// terminate because this transaction was not initiated from your store; it's a fake
}
}
?>
The form has been finalised, prior to updating with this code, which was a response from the payment gateway. So I want to use the update in the preparser to send the emails each time the responses are inserted or altered.
Ben, thank you for the encouragement. Should I remove this sql code now "mysql_query($query) or die(mysql_error()); "
<?php
$hostname = "myhost.com";
$username="myusername";
$password="mypassword";
$dbname="mydatabasename";
$usertable="mytable";
mysql_connect($hostname,$username,$password);
mysql_select_db("mydatabase") or die("Could not select database");
if(isset($_POST['ce_transref']))
{
$ce_res['C00'] = "Transaction successful.";
$ce_res['C01'] = "Transaction cancelled. ";
$ce_res['C02'] = "Transaction cancelled by inactivity.";
$ce_res['C03'] = "Transaction aborted by user.";
// the following are the parameters returned by $_POST
$ceresponse = strtoupper($_POST['ce_response']);
$cetransref = $_POST['ce_transref'];
$ceamt = $_POST['ce_amount'];
$cedata = $_POST['ce_data'];
$cememo = $_POST['ce_memo'];
//echo $cedata;
//print_r ($ceresponse);
if($cedata=='mycode)
{
$query="UPDATE ft_form_99 SET ce_response= '$ceresponse', ce_transref= '$cetransref', ce_amount= '$ceamt', ce_data= '$cedata', ce_memo='$cememo' WHERE cetransref= '$cetransref'";
mysql_query($query);
//mysql_close();
mysql_query($query) or die(mysql_error());
}
else
{
// terminate because this transaction was not initiated from your store; it's a fake
}
}
?>