Define the index.
It looks as though you have failed to intialize an array!
with all of the details you provided, including the code snippet, this is the best we can do!
You really need to expand on the detail of the code. What does it do? What is the expected outcome? Do you get the error in the browser, or where is the error presented?