title: PHP set form values
body: <p>I'm kinda rookie at PHP but i'm trying to developing a backoffice with some tables and value-editing options.</p>
  
  <p>By now, i have tables like this:</p>
  
  <p><img src="https://i.stack.imgur.com/MsGx2.png" alt="enter image description here"></p>
  
  <p>But i'm kinda bugged with this issue:</p>
  
  <p>The change button is being implemented like this:</p>
  
  <pre><code>for ($i = 0; $i &lt; count($a); $i++) {
              ?&gt;
              &lt;tr&gt;
              &lt;td&gt;&lt;i onclick="
              document.form1.deviceFeatValID.value = &lt;?php echo $a[$i][DEVICE_FEATURE_VALUE_ID] ?&gt;;
              document.form1.deviceID.value = &lt;?php echo $a[$i][DEVICE_ID] ?&gt;;
              document.form1.deviceClassFeatID.value = &lt;?php echo $a[$i][DEVICE_CLASS_FEATURE_ID] ?&gt;;
              document.form1.deviceFeatureVal.value = &lt;?php echo $a[$i][DEVICE_FEATURE_VALUE] ?&gt;;
              document.form1.submit();" class="icon-refresh" &gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $a[$i]['DEVICE_FEATURE_VALUE_ID']; ?&gt;&lt;td&gt;&lt;?php echo $a[$i]['DEVICE_ID']; ?&gt;&lt;td&gt;&lt;?php echo $a[$i]['DEVICE_CLASS_FEATURE_ID']; ?&gt;&lt;td&gt;&lt;?php echo $a[$i]['DEVICE_FEATURE_VALUE']; ?&gt;
              &lt;/tr&gt;
              &lt;?php
              }
              ?&gt;
  </code></pre>
  
  <p>That is, by Javascript, i set the input values of this form, in the same .php: </p>
  
  <pre><code>&lt;form name="form1" method="post" action="deviceFeatureValueFRM.php"&gt;
              &lt;input type="hidden" name="deviceFeatValID"/&gt;
              &lt;input type="hidden" name="deviceID"/&gt;
              &lt;input type="hidden" name="deviceClassFeatID"/&gt;
              &lt;input type="hidden" name="deviceFeatureVal"/&gt;
              &lt;input type="hidden" name="hiddenTypeField"/&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>But...do you consider that this is a good practice? Is there another solution?!</p>
  
  <p>The goal of this code is to detect which line is going about to be edited.</p>
  
  <p>Kind regards, </p>
  
  <p>Sam</p>