CodeIgniter Forums
posting code tag in form - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10)
+--- Thread: posting code tag in form (/showthread.php?tid=76780)



posting code tag in form - sigounet - 06-19-2020

hello , i started to get on my old code ingiter website recently and i forgot alot of things Wink ,  i need a bit of help for posting code like iframe

because when i try to post things like <iframe src="https://www.facebook.com/plugins/video.php? allowFullScreen="true"></iframe>

the < get changed to &lt;

and i cant seem to find  where to look if someone could point me in the right direction Smile

i have to modify directly in database actualy to get it to work


this is my controller :
PHP Code:
public function news_new()
  {
      $this->form_validation->set_error_delimiters('<div class="alert alert-error">''</div>');
      if ($this->form_validation->run('news')===FALSE)
      {
      $this->news();
      }
      else
      {
      $this->model_admin->add_news();
      $this->news();
      }
  


my model :
PHP Code:
public function add_news()
{
  $data=array (
    
'titre_news'=>$this->input->post('titre_news'),
    
'introduction'=>$this->input->post('introduction'),
    
'contenu_news'=>$this->input->post('contenu_news'),
    
'tete_pont'=>$this->input->post('tete_pont'),
    
'photo_news'=>$this->input->post('photo_news'),
    );
  $this->db->insert('news'$data);
  $id_emi=$this->db->insert_id();    
  $categorie 
$this->input->post('id_categorie');
  foreach ($categorie as $cat)
  {
      $data =array(
   
'id_categorie' => $cat,
   
'id_news' => $id_emi );
   
$this->db->insert('multi_cat_news'$data); 
  }  



and form validation

Code:
'news' => array(
    array(
        'field' => 'titre_news',
        'label' => 'titre_news',
        'rules' => 'required'
   ),
   array(
        'field' => 'id_categorie',
        'label' => 'id_categorie',
        'rules' => 'required'
   ),
   array(
        'field' => 'introduction',
        'label' => 'introduction',
        'rules' => 'required'
   ),
     array(
        'field' => 'photo_news',
        'label' => 'photo_news',
        'rules' => 'required'
   ),
   array(
        'field' => 'contenu_news',
        'label' => 'contenu_news',
        'rules' => 'required'
   )
   ),

thx for helping out


RE: posting code tag in form - jreklund - 06-19-2020

Check to see if you have the global XSS filter on.


RE: posting code tag in form - sigounet - 06-19-2020

oh my forgot about that , yes indeed global xss filter was on
thx a lot Smile