How can I keep HTML styling in a php form storing data in MySQL? -
so have box user enters data "a description" , stores in mysql. however, html tags such <img src="">
, <a href="">
, etc. not store there in 'description' field. how can allow html codes passed through mysql?
this description input box looks like:
<?=form_textarea( 'description', $channels->description, 'class="field" style="width:306px; height: 70px; margin-left:5px;"' )?>
this form gets passed:
$this->form_validation->set_rules( 'description', lang('user_edit_channel_description'), 'trim|required|strip_tags|xss_clean' );
and posted mysql here:
$rows['description'] = $this->input->post('description');
you need use form of strip_tags
function second parameter, allows specify html tags allowed. explained in this post, need create callback function call because two-parameter version of strip_tags
cannot directly used in set_rules(
.
Comments
Post a Comment