Question: So I have the issue that I am trying to post a variable which is the name of a form input checkbox. However, this name is a variable. When I view page source it shows the name as what I want it to however when I have:

```
$files_name = $_POST['$file_name'];

```

Which works for the other elements that I have, it does not send the value that $file\_name has. I assume it may have something to do with concatenating variable but I've looked up how it is that I'm supposed to do this but I can't work out how to do it or what to do.

---

I have a new kind of issue. This is because whenever I try to show the value of $file\_name at any stage, for some reason it is blank EXCEPT when used in the name="$file\_name" in the form, almost as though it loses its value.

Answer: 
Making `item` final should solve your problem:

```
final String item = itemsList.get(i);

```

You can't access a non-final local variable from an inner or anonymous class like this.
Mark `item` as `final`, this should resolve the issue. This [solution](https://stackoverflow.com/a/7423059/205426)
: 

> 
> Local classes can most definitely reference instance variables. The
>  reason they cannot reference non final local variables is because the
>  local class instance can remain in memory after the method returns.
>  When the method returns the local variables go out of scope, so a copy
>  of them is needed. If the variables weren’t final then the copy of the
>  variable in the method could change, while the copy in the local class
>  didn’t, so they’d be out of synch.
> 
> 
> Anonymous inner classes require final variables because of the way
>  they are implemented in Java. An anonymous inner class (AIC) uses
>  local variables by creating a private instance field which holds a
>  copy of the value of the local variable. The inner class isn’t
>  actually using the local variable, but a copy. It should be fairly
>  obvious at this point that a “Bad Thing”™ can happen if either the
>  original value or the copied value changes; there will be some
>  unexpected data synchronization problems. In order to prevent this
>  kind of problem, Java requires you to mark local variables that will
>  be used by the AIC as final (i.e., unchangeable). This guarantees that
>  the inner class’ copies of local variables will always match the
>  actual values.
> 
> 
>