PHP Sum Up the value of textbox -


How to submit and display the value of the text box For example, the value of the textbox is 1 and 2 and the second text box 3 will display. Please help me solve the problem. Thanks ~

  $ name = $ row ['name']; $ Data2 = mysql_query ("Choose * FROM tblstockmgt WHERE ItemName = '$ name'") or die (mysql_error ()); While ($ row2 = mysql_fetch_array ($ data2)) {resonant " gt; & lt; / td & gt; }  

just create a varabile $ total and always incrase After this, and loop, type the value into a text box:

  $ total = 0; While ($ row2 = mysql_fetch_array ($ data2)) {resonant " Input  gt; & lt; / td & gt; $ Total + = $ line 2 ['value']; }? & Gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> Total: & lt; Input type = "textbox" name = "total" value = "& lt ;? php echo $ total ;? gt;" / & Gt; & Lt; / TD & gt; & Lt; / TR & gt; Avoid SQL injection, avoid your wires in your query. 

  • Use pdo instead of mysqli or mysql function, because mysql functions are disliked.


  • Comments

    Popular posts from this blog

    apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

    c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

    c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -