HTML with PHP - <script>-section code suddenly ends - bug? HTML with PHP - <script>-section code suddenly ends - bug? javascript javascript

HTML with PHP - <script>-section code suddenly ends - bug?


Do you want a fish or to learn to fish ?

"Make it simple, as simple as possible. No more." A.Einstein

Okay, it is maybe a simple answer, but true. You cannot maintain/debug such a spaghetti code in a reasonnable amount of time. Look at the time you loose about this issue. Even with a bounty, you get few luck to solve it, cause talented people dont pay time on such a code.

Your code is clean. No critics. But your method is not. I experienced such cases very often in 10 years of coding. Hours lost, energy expenses. Clarify it all, simplify, synthetize, the failure will appear. Your code will be stronger.

That's my genuine answer.


for ($i = 0; $i < count($lineData)+1; $i++)

should give you an "Undefined offset" notice, try replacing it with

for ($i = 0; $i < count($lineData); $i++)

also, I think you have to be sure that

$lineData[$index-1] = $line[0];

produces an array with all indexes from 0 to count($lineData)-1


Try setting error_reporting(E_ALL); and ini_set('display_errors', 1); at the beggining of your script. It might be that php is throwing an error and not showing it. With these commands you'll activate error reporting and show those errors.