title: Notice: Undefined variable: basic html form
body: <p>this is the code i am working on (it is part of this tutorial <a href="http://www.homeandlearn.co.uk/php/php4p9.html" rel="nofollow">http://www.homeandlearn.co.uk/php/php4p9.html</a> )</p>
  
  <p>this works fine</p>
  
  <p>`    
      
      A BASIC HTML FORM</p>
  
  <pre><code>&lt;?PHP
  
  if (isset($_POST['Submit1'])) {
  $username=$_POST['username'];
  if($username=="ken"){
      print("you the man");
      }
      else {
          print("you are not supposed to be here");
          }
      }
      else{
          $username="";
          }
  
  ?&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;FORM NAME ="form1" METHOD ="post" ACTION = "basicForm.php"&gt;
  
  username: &lt;INPUT TYPE = "TEXT" VALUE ="&lt;?PHP print $username;?&gt;"NAME="username"&gt;
  
  &lt;INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Login"&gt;
  
  &lt;/FORM&gt;
  &lt;/body&gt;
  &lt;/html&gt;`
  </code></pre>
  
  <p>But this does not</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;A BASIC HTML FORM&lt;/title&gt;
  
  &lt;?PHP
  
  
  if (isset($_POST['Submit1'])) {
  
  $username=$_POST['username'];
  $nickname=$_POST['nickname'];
  if($username=='ken'and$nickname=='hawk'){
      print("you the man");
      }
      else {
          print("you are not supposed to be here");
          }
      }
      else{
          $username=""and$nickname="";
          }
  
  ?&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;FORM NAME ="form1" METHOD ="post" ACTION = "testformken.php"&gt;
  
  nickname: &lt;input type="text" VALUE ="&lt;?PHP print $nickname;?&gt;" name="nickname" /&gt;&lt;br /&gt;
  username: &lt;input type="text" VALUE ="&lt;?PHP print $username;?&gt;" name="username" /&gt;
  
  &lt;INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Login"&gt;
  
  &lt;/FORM&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I get this Notice: Undefined variable: nickname in C:\wamp\www\testformken.php on line 30 Call Stack #TimeMemoryFunctionLocation 10.1800367256{main}( )..\testformken.php:0 " name="nickname" /></p>
  
  <p>I have messed with a few things and if i change </p>
  
  <pre><code>nickname: &lt;input type="text" VALUE ="&lt;?PHP print $nickname;?&gt;" name="nickname" /&gt;&lt;br /&gt;
                        to
  nickname: &lt;input type="text" VALUE ="&lt;?PHPprint$nickname;?&gt;" name="nickname" /&gt;&lt;br /&gt;
  </code></pre>
  
  <p>I do not get a the undifined variable but it does not print the nickname either
  if i change the value to </p>
  
  <pre><code>&lt;?PHP print $username;?&gt; 
  </code></pre>
  
  <p>enter code here i do not get the undifined variable.</p>