Real time calculation with PHP & array
<p>For a client i'm currently working on their new system. In this system they can create bookings/invoices and send them to their clients.</p>

<p>On 1 page my client is needed to fill in the price for each container in the qoutation. My client asked me to make a new table column below the container columns with the total prices for all containers. I want to do this real time, so when my client fills in the prices the total price changes.</p>

<p>The only problem I stumble on is this:
I currently have PHP/MySQL function that collect all the containers from a certain quotation out of the database. With a while loop I create the needed html code for each of the containers. I made the input fields (where they fill in the prices) an array by naming the input fields like this:</p>

<pre><code>&lt;td&gt;&amp;euro; &lt;input type="text" name="msg_container['.$i.'][ocean_freight]" value="'. $quote['ocean_freight'].'" style="width: 100px;" /&gt;&lt;/td&gt;
</code></pre>

<p>The $i variable get's count up for each loop. It starts by 0 and ends when there are no containers left.</p>

<p>To make things a bit more detailed I have created a jsfiddle how the currently page looks like: <a href="https://jsfiddle.net/cwfmqbqv/" rel="nofollow">https://jsfiddle.net/cwfmqbqv/</a></p>

<p>Now I'm not an expert in javascript so I'm stuck at this point. Long story short, how am I able to calculate all the values in the array in real time?</p>