PHP/MYSQL Averaging each row

I have a form with X amount of columns that are labeled C1, C2, CX. I also have a column labeled "Average" and another labeled "Target". The "Average" column finds the average of each row in columns C1 - CX. Is it possible for the "Average" column to dynamically change while user is filling in the form? If so, how?

If that is not possible, then how do I have the "Average" column update its value upon submitting the form with the edited C1-CX values?

Just looking for tips on how to deal with the Averages. I already have working C1-CX columns with pre-defined fields that save to a MYSQL database.


Add an event handler that triggers when any of the CX form field values have been changed (e.g. a user changing the value in it) and then re-calculate the average and display it in the average column.

Probably something like the following, assuming your CX forms are inputs:

document.getElementById("C1").addEventListener("input", function(){
    // Any time the user changes a value in form 'C1',
    // this function will be called so you can re-calculate
    // a new average and stuff...

Need Your Help

Using .split() to break down a String into an array

javascript jquery json

I am trying to break down a string into an array. This code below does do it, but I now need to break it down into a either a sub array.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.