Convert form values to numbers and reject non-finite values before rebuilding the chart data.
function readNumber(id) {
const value = Number(document.getElementById(id).value);
return Number.isFinite(value) ? value : 0;
}
const php = readNumber('php');
const mysql = readNumber('mysql');Current example first; the original chart examples below are retained and cleaned up for continued learning.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.