Hi,
I have been doing some work trying to get the 'PHP code to execute on form submission' working, I have worked out quite a bit, but still cant seem to get the data to update on the table and therefore think it may be somenthing I am doing wrong.
I am taking data from my form and doing some changes to it the the 'php', then I am trying to write it back to the table. The problem I have is that none of my changes are recording to the db.
Here is my code - (There is more work to do on the date function).
global $database;
$nextcall = mosGetParam($_POST, 'properties___date_nextcall');
$hma = mosGetParam($_POST, 'properties___neg_id');
if ($nextcall == '')
{
if ($hma <> '')
{
$uid = mosGetParam($_POST, 'properties___property_id');
$motivation = mosGetParam($_POST, 'properties___motivation_id');
$event = '1'; // event is now equal to Intro Call
if ($motivation == 1) $review = 'reviewa'; //motivation is high
if ($motivation == 2) $review = 'reviewb'; //motivation is medium
if ($motivation == 3) $review = 'reviewc'; //motivation is low
$sql = "SELECT $review FROM events WHERE event_id = $event";
mysql_select_db('events');
$reviewperiod = mysql_query($sql);
$nextcall = date(Y-m-d);
$sql = "UPDATE properties SET date_nextcall = $nextcall WHERE property_id = $uid";
mysql_select_db('properties');
$result = mysql_query($sql);
}
}
//echo $database->getQuery();
//echo $database->getErrorMsg();
//exit;
I think I may be writing to the db and then fabrik is overwriting with what was originally on the form???
I am using the 'after Fabrik has processed the form (simple)' option.
Thanks
Mark.
I have been doing some work trying to get the 'PHP code to execute on form submission' working, I have worked out quite a bit, but still cant seem to get the data to update on the table and therefore think it may be somenthing I am doing wrong.
I am taking data from my form and doing some changes to it the the 'php', then I am trying to write it back to the table. The problem I have is that none of my changes are recording to the db.
Here is my code - (There is more work to do on the date function).
global $database;
$nextcall = mosGetParam($_POST, 'properties___date_nextcall');
$hma = mosGetParam($_POST, 'properties___neg_id');
if ($nextcall == '')
{
if ($hma <> '')
{
$uid = mosGetParam($_POST, 'properties___property_id');
$motivation = mosGetParam($_POST, 'properties___motivation_id');
$event = '1'; // event is now equal to Intro Call
if ($motivation == 1) $review = 'reviewa'; //motivation is high
if ($motivation == 2) $review = 'reviewb'; //motivation is medium
if ($motivation == 3) $review = 'reviewc'; //motivation is low
$sql = "SELECT $review FROM events WHERE event_id = $event";
mysql_select_db('events');
$reviewperiod = mysql_query($sql);
$nextcall = date(Y-m-d);
$sql = "UPDATE properties SET date_nextcall = $nextcall WHERE property_id = $uid";
mysql_select_db('properties');
$result = mysql_query($sql);
}
}
//echo $database->getQuery();
//echo $database->getErrorMsg();
//exit;
I think I may be writing to the db and then fabrik is overwriting with what was originally on the form???
I am using the 'after Fabrik has processed the form (simple)' option.
Thanks
Mark.