Note that there are some explanatory texts on larger screens.

plurals
  1. POGet javascript values to insert them into mysql database
    primarykey
    data
    text
    <p>The following code is used for getting two values from two textboxes , calculate the sum using javascript and display the result in third textbox. When I click the button, I just want these textbox values (both input and result) to be inserted into mysql database. I want to do this in the same page. How can I get the javascript values to php for inserting them into database? It would be great if you could help.</p> <p>Thanks <br/> Jeny</p> <p>Code:</p> <hr> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script language="javascript"&gt; function getText3() { var in1=document.getElementById('in1').value; var in2=document.getElementById('in2').value; var in3 = parseInt(in1, 10) + parseInt(in2, 10); document.getElementById('in3').value=in3; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form&gt; &lt;table width="306" border="0"&gt; &lt;tr&gt; &lt;td width="146"&gt;Enter A &lt;/td&gt; &lt;td width="144"&gt;&lt;input name="text" type="text" id="in1"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Enter B &lt;/td&gt; &lt;td&gt;&lt;input name="text2" type="text" id="in2"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="41" colspan="2"&gt; &lt;center&gt; &lt;button type="button" onclick="getText3()"&gt; Get calculated result&lt;/button&gt;&lt;/center&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;strong&gt;RESULT&lt;/strong&gt;&lt;/td&gt; &lt;td&gt;&lt;input name="text3" type="text" id="in3"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload