954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Auto Calculate Text Boxes onload & onkeyup

Hi,

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>";
               
             }
borgyborg
Newbie Poster
12 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

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

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,800 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 
borgyborg
Newbie Poster
12 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

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.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,800 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

@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!

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 

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

borgyborg
Newbie Poster
12 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: