Hi. True newbie here. Just doing something to try and get the hang of this.

I have a Form with 3 txt fields and 1 Submit Button.

I am simply trying to add txtfield1 with textfield2 and display the result in txtfield3 when the Button is clicked.

I am trying to make a php file to handle the math work and the output to the Result field, but i have no clue how to Include it in an OnClick event so it does the math and then outputs the result to the right field.

Also, how do i get the values of the txtfileds and calculate them in the php file?

Any help at all is greatly appreciated

    so yer saying this isnt possible with PHP?

      It's impossible in the fact that PHP is a server side scripting language. So basically, once the web page is displayed, that's it. PHP is parsed at the time the web server sends the page to the user's browser. What you want to do is to make a control that allows someone to see an update on the page AFTER the page has been displayed. The only way you could do it in PHP would be to have them type in the two fields, hit submit, and then redisplay the page with the concatenated value. Which would be stupid.

      So yes, you want to use JavaScript for that. It's about 1 line of code, no big deal.

      m7_b5

        A PHP script runs when your browser requests the .php file from the server. The code is executed on the server and generates output, which it sends back to the browser as a regular HTML page. So you could create a form which submitted to a PHP script, and then that script would add the values together and output an html page containing the result.

          Oops, I just restated what m7_b5 said, only he said it better. Sorry.

            10 months later

            i realize this post is a million years old, but lol u can do this easy in php.. dumb noobs

              Originally posted by FrozNic
              i realize this post is a million years old, but lol u can do this easy in php.. dumb noobs

              "A PHP script runs when your browser requests the .php file from the server. The code is executed on the server and generates output, which it sends back to the browser as a regular HTML page. So you could create a form which submitted to a PHP script, and then that script would add the values together and output an html page containing the result."

              you're the "dumb noob", FrozNic, for not reading the replies carefully first.

                Write a Reply...