title: passing td data to a hidden input and then posting with PHP
body: <p>I have a form that I have shortended for simplicty but the concept is the same. </p>
  
  <pre><code>&lt;form method=post action= somephp.php&gt;
  &lt;table&gt;
  &lt;tr&gt;&lt;td&gt;&lt;input name= first&gt;&lt;/tr&gt;// These input are where people enter 
  &lt;tr&gt;&lt;td&gt;&lt;input name= second&gt;&lt;/tr&gt;// numbers. They then click on
  &lt;tr&gt;&lt;td&gt;&lt;input name= third&gt;&lt;/tr&gt;//calculate and the results appear
  &lt;tr&gt;&lt;td&gt;&lt;input name= fourth&gt;&lt;/tr&gt;//in the below table
  &lt;td&gt;Result one &lt;input type = "hidden" name="somename" value=""&gt;&lt;/td&gt;// 
  &lt;td&gt;Result two &lt;input type = "hidden" name="somename1  value=""&gt;&lt;/td&gt;  
  &lt;button&gt;Calculate&lt;/button&gt;
  &lt;button type submit&gt;save&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The form works fine . The maths for the form is performed using javascript. I get the values of the results in the  result one and two as expected . </p>
  
  <p>Now for my problem After I have clicked calculate and got my results I click on the save button and want it to post all of the inputs including the hidden ones to a PHP script.</p>
  
  <p>I am having problems posting the hidden feilds.</p>
  
  <p>It works if I place a figure in the value attribute but what I want and have been struggling all night with is how can I post the result one and two feilds to my PHP script via the hidden feild. </p>
  
  <p>I have been trying in vain to get the variable from my js script to act as the value for the hidden feild but keep getting undefined index error in PHP. I think it may be because the page has already loaded. I have attached the variable that holds the value for result one and result two to onChange event etc but can not get this to work. </p>
  
  <p>As a summary - how can I pass a td inner HTML (result 1 and result 2) to  hidden inputs value for posting to a PHP script. 
  I am open to other solutions </p>
  
  <p>Thanks in advance for your help.</p>
  
  <pre><code>&lt;script&gt;
  
  var a = document.getElementByID('result one id').value;
  var b = document.getElementByID('HIDDEN INPUT ID').value; 
  </code></pre>
  
  <p>I want a = b </p>
  
  <p>but am struggling</p>