title: Converting Celsius to Fahrenheit and Vice Versa in PHP
body: <p>I am new to PHP and I am trying to write two functions that convert Celsius to Fahrenheit and vice versa, where the temperature is a user input and the conversion is posted , below is my code that I am hoping to get help with</p>
  
  <p>Thank you in advance to anyone who can help</p>
  
  <pre><code>&lt;?php
  function fahrenheit_to_celsius($temp)
  {
      $celsius=5/9*($temp-32);
      return $celsius ;
  }
  
  function celsius_to_fahrenheit($temp)
  {
      $fahrenheit=$temp*9/5+32;
      return $fahrenheit ;
  }
  
  
  
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Change Temperature&lt;/title&gt;
          &lt;style&gt;
              #myForm {
      border: 1px solid grey;
      padding: 5px;   
      width: 600px;
  }
  
  .centered {
      width: 100%;
      text-align: center;
  }
  
  
          &lt;/style&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;div id="myForm"&gt;
          &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']?&gt;" method="post"&gt;
  
  
              &lt;label for="temperature"&gt;Temperature:&lt;/label&gt;
              &lt;select id="temperature" name="temperature" class="myDropdown"&gt;
                  &lt;option value=""&gt;Please select a temperature...&lt;/option&gt;
                  &lt;option value="C"&gt;celsius to fahrenheit&lt;/option&gt;
                  &lt;option value="F"&gt;fahrenheit to celsius&lt;/option&gt;
              &lt;/select&gt;
  
              &lt;br&gt;&lt;br&gt;
  
  
  
              &lt;br&gt;&lt;br&gt;
  
              &lt;?php
              if ($temperature==="C"){
  
                      echo celsius_to_fahrenheit($_POST[$celsius]);
                  }
  
  
              if ($teperature==="F"){
                  echo fahrenheit_to_celsius($_POST[$temp]);
  
              }
  
              ?&gt;
  
              &lt;label for="temp"&gt;Enter your temperature:&lt;/label&gt;
              &lt;input type="text" id="temp" name="temp"&gt;
  
  
  
  
              &lt;div class="centered"&gt;
                  &lt;input type="submit" value="Submit temperature"&gt;
              &lt;/div&gt;
  
          &lt;/form&gt;
      &lt;/div&gt;
  
      &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>