警告:implode():传入的参数无效:Joomla?

I have a team registration form on my joomla website and this error appears when the user goes to create a team.

Warning: implode(): Invalid arguments passed in /home/xboxfifa/public_html/HD/components/com_joomsport/views/regteam/tmpl/default.php on line 21

Here is line 21.

$new_tmp = implode(',',$tmp);

Here is the full code.

defined( '_JEXEC' ) or die( 'Restricted access' );

`JHTML::_('behavior.formvalidation');
$new_temp = $Itemid = JRequest::getInt('Itemid');
$lists = $this->lists;
foreach ($this->lists['team_reg'] as $dta) 
{
    $tmp[]='\''.addslashes($dta).'\'';
}
$new_tmp = implode(',',$tmp);

Thank you.

You will get this error if your foreach loop never happens (if you have no $this->lists['team_reg'] to loop over).

$tmp = array(); // do this just in case you have no records below
foreach ($this->lists['team_reg'] as $dta) 
{
    $tmp[]='\'.addslashes($dta).'\';
}
$new_tmp = implode(',',$tmp);

Your $tmp is not defined as array.