Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP code is visible on website
    text
    copied!<p>I am in the process of learning PHP and I ran into a snag, and I feel it is because the video tutorials I am watching are from 2005 and some of the API's haven't transferred over to current standards. Long story short one of the "challenges" is to create a quiz and no matter what I do the PHP code leaks over and is printed along with the HTML.</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;Chapter #4 Challenge&lt;/title&gt;&lt;/head&gt; &lt;body&gt; &lt;h2&gt; Chapter #4 Quiz&lt;/h2&gt; &lt;?php $question1 = "&lt;b&gt;Question #1: What does the operator == mean?&lt;/b&gt;&lt;br&gt; A) &lt;input type=radio name='q1' value='a'&gt;Equals&lt;br&gt; B) &lt;input type=radio name='q1' value='b'&gt;Not Equal&lt;br&gt; C) &lt;input type=radio name='q1' value='c'&gt;True&lt;br&gt; D) &lt;input type=radio name='q1' value='d'&gt;Assignment&lt;br&gt; &lt;input type=submit value='Submit'&gt; &lt;/form&gt;&lt;br&gt;"; $q1answer = "d"; ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The code outputs everything that it is supposed to but at the very end it also prints out:" "; $q1answer = "d"; ?>"</p> <p>What's confusing to me is why it prints anything at all, for starters, because I am just instantiating a variable and no where am I printing it. Second, why is it displaying the PHP code as text output? </p> <p>Also, for the record I am using a switch statement which prefixes the variable $question1 with the opening "form" brackets so I don't think it is because I am including it on the variable. Any thoughts would be greatly appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload