I would like to have a php script or javascript to calculate the array textboxes where values fetched from the database.

My array textboxes code below:

$sql="SELECT * FROM records WHERE is_active = 'Yes'";   
            $result=mysql_query($sql,$connection) or die(mysql_error());

       while ($row=mysql_fetch_array($result)) {
                $default_salary = $row["default_salary"];

        echo "<input onkeyup=\"AddInputs()\" type=\"text\" class=\"validate[required,custom[onlyNumberSp],maxSize[5],minSize[3]] text-input\" id=\"default_salary[$id]\" size=\"4\" name=\"default_salary[$id]\" value=\"$default_salary\" >";
        echo "</td>";
        echo "<td width=\"\" align=\"left\" border=\"0\">";
        echo "<input type=\"text\" class=\"validate[required,custom[onlyNumberSp],maxSize[5],minSize[1]] text-input\" id=\"additional_salary[$id]\" size=\"4\" name=\"additional_salary[$id]\" value=\"0\">";
        echo "</td>";

Recommended Answers

All 5 Replies

Member Avatar

So? What do want, someone to write the js script for you?

Member Avatar

How about you have a go yourself and post your effort? Then we can tell you where you're going wrong. Either that or pay somebody to do your coding for you.

@borgyborg forum rule Keep It Organized say that you are to provide evidence of having done some work yourself if posting questions from school or work assignments. That doesn't mean that you post a code where you want to add something add someone will do rest for you.

We are NOT 24/7 coding forum for lazy individuals!

Thanks to both of you. I've done the JS code and it's working now. i Just didn't posted it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.