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

[eluser]Mitja B.[/eluser]
Code:
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
#2

[eluser]Bramme[/eluser]
$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';
#3

[eluser]Mitja[/eluser]
what do you want to do with this?
#4

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

With $_POST i am using

Code:
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?
#5

[eluser]loathsome[/eluser]
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)
#6

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

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

Thx




Theme © iAndrew 2016 - Forum software by © MyBB