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!