Look at your template as well and the uploadproduct file they are all initialized as arrays and the code works as posted and shown by my example.
If your happy you think your change works then okay. I was just merely pointing out there should be no need to change code. $i is nothing relatively speaking just a beautification or reminder we are processing an array. $thesevars is set to custom- which is indeed correct.
Content visible to verified customers only.
All the variables for the customs are an array defined by custom- and we do a foreach.