
I am using CMSMS 1.6.7 and FormBuilder 0.6.1
Here is what I want it to do:
The user is given a code that is stored in the database from a previous form entry.
In a subsequent form, the user will enter a code into a text field. When the form is processed, the following UDT is called, and it will designate the price field (a hidden field) to be 75.00 (if the code is found in the database) or 95.00 (if the code is not found in the database).
Code: Select all
global $gCms;
$db =& $gCms->GetDb();
$code=$params['code'];
$price=$params['price'];
if ($_POST["code"]) {
$conn= "mysql_connect('localhost', 'mysql_user', 'mysql_password')";
$sql = "SELECT COUNT(1) AS matches FROM cms_module_fb_resp_val WHERE field_id=39 = '{$code}'";
$result = mysql_query($conn, $sql);
if ($row = mysql_fetch_assoc($result)) {
$good = $row["matches"] >= 1;
}
mysql_free_result($result);
if ($good) {
$price="75.00";
} else {
$price="95.00";
}
}
Any help is appreciated.