title: radio button value in php
body: <p>I'm trying to make a simple survey in php</p>
  
  <p>I have a set of radio buttons on a page called sja.php that sends its to sjamail.php page</p>
  
  <p>the problem is that when I go to get </p>
  
  <pre><code>$answer = $_POST['ans'];
  </code></pre>
  
  <p>I can't seen to do anything like</p>
  
  <pre><code>echo "$answer";
  </code></pre>
  
  <p>but if I were to throw some logic at it</p>
  
  <pre><code>like
  
      if ($answer == "ans1") {
  
          echo 'Correct';
      }
  
     else {
  
         echo 'Incorrect';
      }    
  </code></pre>
  
  <p>It will display correct or incorrect (edit: The if/else works correctly and will display the correct answer )</p>
  
  <p>so why is it I can't access the value of the radio button "ans" as a string?</p>
  
  <p><a href="http://www.markonsolutions.com/sja.php" rel="nofollow noreferrer">http://www.markonsolutions.com/sja.php</a></p>
  
  <p><code>print_r($_POST);</code> will return <code>Array ( [ans] =&gt; )</code> </p>