【发布时间】:2011-10-13 05:03:52
【问题描述】:
所以我有一个框,用户可以在其中输入一些数据“描述”并将其存储在 MySQL 中。
但是,<img src="">、<a href=""> 等 html 标签不会存储在“描述”字段中。如何允许某些 HTML 代码传递到 MySQL?
描述输入框是这样的:
<?=form_textarea(
'description',
$Channels->description,
'class="field" style="width:306px; height: 70px; margin-left:5px;"'
)?>
这是表单被传递的地方:
$this->form_validation->set_rules(
'description',
lang('user_edit_channel_description'),
'trim|required|strip_tags|xss_clean'
);
然后在这里发布到MySQL:
$rows['description'] = $this->input->post('description');
【问题讨论】:
-
谢谢,我会调查的
-
也许该链接可以帮助您。 php.net/manual/en/function.strip-tags.php
标签: php mysql forms codeigniter