title: Update Hidden Field Value Inside PHP Function
body: <p>I am new to php and am trying to update a hidden field value inside a php function and can't see to find a solution that works.</p>
  <p>In template.php I have:</p>
  <pre><code>&lt;input type=&quot;hidden&quot; id=&quot;variable_ID&quot; name=&quot;variable_name&quot; value=&quot;variable_value&quot;&gt;
  </code></pre>
  <p>This works fine.</p>
  <p>However I need to update the value of the variable to the record ID of inserted record in a function in functions.php eg</p>
  <pre><code>function myFunction() {
  
  $insert_record = $mydb-&gt;query(&quot;INSERT INTO `Table`(`Name`) VALUES ('John')&quot;);
  $get_record_id = $mydb-&gt;insert_id;
  
  // *** Set Hidden field value to $get_record_id here ***
  
  }
  </code></pre>
  <p>I have tried a myriad of things but can't seem to find a solution.
  Any pointers on how to solve this problem?</p>