I am trying to escape some HTML in forms for an open cart site - it is custom coding with session data that is throwing me off. Currently I have:

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

I attempted to use:

<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" />

but this did not do the trick. I thought htmlentities should begin before the variable.

This is in open cart FYI using PHP under their MVC.

有帮助吗?

解决方案

Try: <?php echo htmlentities($this->session->data['persline_2']); ?> note the parentheses ()

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top