I solved my problem
echo JHtml::_('form.csrf');
jimport( 'joomla.html.editor' );
$config = JFactory::getConfig();
$global_editor = $config->get( 'editor' );
$user_editor = JFactory::getUser()->getParam("editor");
if($user_editor && $user_editor !== 'JEditor') {
$selected_editor = $user_editor;
} else {
$selected_editor = $global_editor;
}
$editor = JEditor::getInstance($selected_editor);
$editor_params = array( 'smilies'=> '0' ,
'style' => '1' ,
'layer' => '0' ,
'table' => '0' ,
'clear_entities'=>'0',
'mode' => '1',
'buttons' => 0
);
echo "<form> ";
echo $editor->display('editMain', '', '100%', '400', '20', '20', true, null, null, null, $editor_params);
echo JHtml::_( 'form.token' );
//echo '<input id="token" type="hidden" name="' . JSession::getFormToken($forceNew = true) . '" value="1" />';
echo "</form>";
This works . I was had placed the csfr in the wrong place and once it was in the right place all worked as expected.
=&
as a combined operator, because it is not a combined operator. If you are a developer that is careful about every character in your script, have a read of this: stackoverflow.com/a/63914758/2943403 It is simple to fix by doing a project-wide search&replace through your IDE.