Welcome Guest, Not a member yet? Register   Sign In
HELP! disable html in textarea
#1

[eluser]codedoode[/eluser]
The title pretty much tells it all. I'm trying to disable the use of html in a textarea. Can anyone shed some light on this subject? Thanks in advance.

this is my controller
Code:
function create()
    {
        $data = array(
            'content' => $this->input->post('content')
        );

        $stripped = strip_tags($data);
        $this->site_model->add_record($data);
        $this->index();
    }

this is my model
Code:
function add_record($data)
    {
        $this->db->insert('data', $data);
    }

what am I doing wrong?
#2

[eluser]danmontgomery[/eluser]
strip_tags()?
#3

[eluser]codedoode[/eluser]
bump still need help!
#4

[eluser]WanWizard[/eluser]
With what exactly?

It seems to me that noctrum already answered your question? Or is there more to this?
#5

[eluser]codedoode[/eluser]
We'll I'm trying to implement what noctrum said, and I just can't seem to get it to work correctly. Please review the code I posted above, and let me know what I'm doing wrong.
#6

[eluser]WanWizard[/eluser]
$this->db->insert requires an array as $data.
So it should be something like
Code:
$this->site_model->add_record( array('contents' => $data) );
assuming that the field in your database table is called 'contents'...
#7

[eluser]codedoode[/eluser]
That didn't work I got a bunch of errors.
#8

[eluser]WanWizard[/eluser]
Missed that your data is already in an array, but the way you coded the stripped tags made me miss the error.

Code:
function create()
    {
        $data = array(
            'content' => strip_tags( $this->input->post('content') )
        );
        $this->site_model->add_record($data);
        $this->index();
    }
#9

[eluser]codedoode[/eluser]
Thank you so much for your help. I knew earlier I was on the right track, I originally had:

Code:
strip_tags( 'content' => $this->input('content') )

Thanks again for the help!




Theme © iAndrew 2016 - Forum software by © MyBB