title: PHP variable and HTML text input value
body: <p>I am trying to display the value from a PHP variable in the value of an HTML text input field. Currently the text input field after submit just prints the contents of the PHP script. The script is called submit_type.php</p>
  
  <pre><code>&lt;?php
      if(isset($_POST['submit'])) {
              $wire_type = $_POST['wire_type_option'];
              header("Location: ./guest.html");
      }
      else {
              echo "loop";
      }
  ?&gt;
  </code></pre>
  
  <p>I have already tried the solution from the question <a href="https://stackoverflow.com/questions/4446727/using-a-php-variable-in-an-text-input-value-statement?rq=1">Using a PHP variable in a text input value = statement</a>
  as seen in the guest.html line 39, but it doesn't seem to work</p>
  
  <pre><code>&lt;input type="text" name="type" value="&lt;?php echo htmlspecialchars($wire_type); ?&gt;" /&gt;
  </code></pre>
  
  <p>The submit button on the main index.html page redirects you to guest.html (almost identical to the index.html file, with the exception of line 39, where the value is set)</p>
  
  <p>For reference, here is guest.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;Current
      &lt;head&gt;
              &lt;title&gt; Thermocouple Database&lt;/title&gt;
              &lt;link rel="stylesheet" type="text/css" href="main.css"&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
              &lt;section&gt;
                      &lt;h1&gt; Login to upload a calibration&lt;/h1&gt;
                      &lt;form&gt;
                              &lt;div class='login'&gt;&lt;label for="username"&gt; Username: &lt;/label&gt;&lt;/div&gt;
                              &lt;input type="text" name="username"&gt;
                              &lt;div class='pass'&gt;&lt;label for="password"&gt; Password: &lt;/label&gt;&lt;/div&gt;
                              &lt;input type="text" name="password"&gt;
                              &lt;input type="submit" value="Submit"&gt;
                              &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt;
                      &lt;/form&gt;
              &lt;/section&gt;
              &lt;section&gt;
                      &lt;h1&gt; Which thermocouple type do I have? &lt;/h1&gt;
                      &lt;label&gt; My wire looks like: &lt;/label&gt;
                      &lt;form method="post" action="submit_type.php"&gt;
                      &lt;select name='wire_type_option'&gt;
                              &lt;option value="J-type"&gt; J-type &lt;/option&gt;
                              &lt;option value="K-type"&gt; K-type &lt;/option&gt;
                              &lt;option value="T-type"&gt; T-type &lt;/option&gt;
                              &lt;option value="E-type"&gt; E-type &lt;/option&gt;
                      &lt;/select&gt;
                      &lt;input type="submit" name="submit" value="Submit wire type"&gt;
                      &lt;/form&gt;
                      &lt;!-- &lt;form method="get" action="action.php"&gt; --&gt;
                      &lt;div id="results"&gt;
                              Result: &lt;label name="result_label"&gt; &lt;/label&gt;
                              &lt;div id="result_table"&gt;
                                      &lt;label&gt; Type: &lt;/label&gt;
                                      &lt;input type="text" name="type" value="&lt;?php echo htmlspecialchars($wire_type); ?&gt;" /&gt;
                                      &lt;label&gt; Temperature Range: &lt;/label&gt;
                                      &lt;input type="text" name="min_temp"&gt;
                                      &lt;label&gt; - &lt;/label&gt;
                                      &lt;input type="text" name="max_temp"&gt;
                                      &lt;br&gt; &lt;br&gt; &lt;br&gt;
                                      &lt;label&gt; Published calibration &lt;/label&gt;
                                      &lt;br&gt; &lt;br&gt;
                                      &lt;label&gt; Voltage: &lt;/label&gt;
                                      &lt;input type="text" name="in_voltage"&gt;
                                      &lt;label&gt; Calibrated Temperature: &lt;/label&gt;
                                      &lt;input type="text" name="out_temp"&gt;
                                      &lt;br&gt; &lt;br&gt;
                                      &lt;label&gt; Temperature: &lt;/label&gt;
                                      &lt;input type="text" name="in_temp"&gt;
                                      &lt;label&gt; Calibrated Voltage: &lt;/label&gt;
                                      &lt;input type="text" name="out_voltage"&gt;
                              &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;!-- &lt;input type="submit" value="Submit"&gt; --&gt;
                      &lt;!-- &lt;/form&gt; --&gt;
              &lt;/section&gt;
      &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>What am I missing here? I am still new to web development, so any and all help is appreciated!</p>