html - PHP/MYSQL Averaging each row -
i have form x amount of columns labeled c1, c2, c3..to cx. have column labeled "average" , labeled "target". "average" column finds average of each row in columns c1 - cx. possible "average" column dynamically change while user filling in form? if so, how?
if not possible, how have "average" column update value upon submitting form edited c1-cx values?
just looking tips on how deal averages. have working c1-cx columns pre-defined fields save mysql database.
add event handler triggers when of cx form field values have been changed (e.g. user changing value in it) , re-calculate average , display in average column.
probably following, assuming cx forms inputs:
document.getelementbyid("c1").addeventlistener("input", function(){ // time user changes value in form 'c1', // function called can re-calculate // new average , stuff... });
Comments
Post a Comment