Reputation:
This is my form.
<?php echo form_open('welcome/post_large'); ?>
<textarea name="large"></textarea>
<input type="submit" name="mysubmit" value="Submit Post!" />
<?php echo form_close(); ?>
And this is my controller/Method
public function post_large()
{
echo $this->input->post('large');
}
When i post plain text.It works fine. but when i post html data like <a href="#">link</a>
.It post only <
.How do i post html through my form.
Upvotes: 0
Views: 458
Reputation: 473
Try this...
public function post_large()
{
echo htmlspecialchars($this->input->post('large'));
}
Upvotes: 1
Reputation: 85
Well. With PHP, the only way to really create an HTML snippet or process it is if you put your HTML code in an echo '', but since a user inputs the data. I recommend creating an HTML form that accepts HTML input, which you can restrict in PHP or Javascript.
Upvotes: 0