Hey, I've searched the forum high and low.. seen a couple similar problems.. but haven't been able to figure it out yet.
I have a form that auto-saves to a mysql table "jos_applicants" and it does so fine.. I need to insert a row into another table with the id that it got back from that last insert..
I've setup the RunOrder like so..
Plugins: 1
AutoGenerated: 2
OnSubmit: 3
Also AutoGenerated dropdown is set to "Before Email" here's the code..
So in the onsubmit (before email) I call 'global $row_jos_applicants;', and when i do "gettype($row_jos_applicants);" i get "NULL".. so obviously its not getting there.. any thoughts?
Thanks in advance!
I have a form that auto-saves to a mysql table "jos_applicants" and it does so fine.. I need to insert a row into another table with the id that it got back from that last insert..
I've setup the RunOrder like so..
Plugins: 1
AutoGenerated: 2
OnSubmit: 3
Also AutoGenerated dropdown is set to "Before Email" here's the code..
<?php
if($paramsvalues->dbconnection == "Yes"){
$user = JFactory::getUser();
$row =& JTable::getInstance("applicants", "Table");
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );
if (!$row->bind( $post )) {
JError::raiseWarning(100, $row->getError());
}
if (!$row->store()) {
JError::raiseWarning(100, $row->getError());
}
global $row_jos_applicants;
$row_jos_applicants = $row;
}
?>
So in the onsubmit (before email) I call 'global $row_jos_applicants;', and when i do "gettype($row_jos_applicants);" i get "NULL".. so obviously its not getting there.. any thoughts?
Thanks in advance!
Hi truent,
For testing, please check your code in the OnSubmit After box - I'm not sure that the OnSubmit Before code will run before the Autogenerated Code (i.e. I think the run-order settings only affect the OnSubmit After code).
Bob
For testing, please check your code in the OnSubmit After box - I'm not sure that the OnSubmit Before code will run before the Autogenerated Code (i.e. I think the run-order settings only affect the OnSubmit After code).
Bob
please note that the global variable has changed in the latest releases so if you made an upgrade it will not work till you fix it!
Regards,
Max
Regards,
Max
This topic is locked and no more replies can be posted.