Reputation: 240
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.
Upvotes: 1
Views: 803
Reputation: 46620
Try: <?php echo htmlentities($this->session->data['persline_2']); ?>
note the parentheses ()
Upvotes: 2