Welcome Guest, Not a member yet? Register   Sign In
$this->input->post problem

[eluser]Mitja B.[/eluser]
foreach($this->input->post => $vrednost)
   if (!is_array($this->input->post($kljuc)))
    $this->input->post($kljuc) = htmlspecialchars($this->input->post($kljuc));

i want to use htmlspecialchars in all $this->input->post but i get this warning

Parse error: syntax error, unexpected T_DOUBLE_ARROW in C:\HTTPSERVER\wwwroot\bewoop\system\application\controllers\happening.php on line 22

$this->input->post is not a variable and certainly not an array, so you can't loop through it with a foreach.

If you use validation, you could simply use this:

$rules[$kljuc] = 'htmlspecialchars';

what do you want to do with this?

[eluser]Mitja B.[/eluser]
Hi, thx for answer.

With $_POST i am using

foreach($_POST as $key => $value)
    if (!is_array($_POST[$key]))
        $_POST[$key] = htmlspecialchars($_POST[$key]);

but i want to make this for $this->input->post() becouse in CI i am using $this->input->post() instead of $_POST.

Is it possible to make this?

Just use the validation library, validate data BEFORE it goes into processing, and throw the entire array into your database (or whatever you're going to do with it)

[eluser]Mitja B.[/eluser]
i am already using form validation or there is any other validation?

[eluser]Mitja B.[/eluser]
Did you mean escape it with $this->db->escape()


Theme © iAndrew 2016 - Forum software by © MyBB