2012-05-03 32 views
1

我想在表单中为一个打开的购物车网站转义一些HTML--这是使用会话数据将自己扔掉的自定义编码。目前,我有:用HTMLENTITIES转义

<input type="text" value="<?php echo $this->session->data['persline_2']; ?>" name="persline_2" id="persline_2" class="keyboardInput" style="width:200px" maxlength="30" /> 

我尝试使用:

<input type="text" value="<?php echo htmlentities$this->session->data['persline_2']; ?>" name="persline_2" id="persline_2" class="keyboardInput" style="width:200px" maxlength="30" /> 

但这并没有这样的伎俩。我认为htmlentities应该在变量之前开始。

这是开放式购物车的FYI在他们的MVC下使用PHP。

+0

您需要周围的括号内的项目要使用'htmlentities'上..你应该更具体的什么“没做的伎俩”是指为好。错误消息/预期/实际行为将大大帮助我们回答您的问题。 –

回答

2

尝试:<?php echo htmlentities($this->session->data['persline_2']); ?>注意括号()

+0

非常感谢! – Andrew