title: PHP HTML form session
body: <pre><code>&lt;?php
  session_start();
  ?&gt;
  &lt;html&gt;
  
  &lt;body&gt;
  &lt;form action="process.php" method="post"&gt;
   Name: &lt;input type="text" name="username" value="&lt;?php echo $_SESSION['u']; ?&gt;" /&gt;
   &lt;input type="submit" value="Submit"/&gt;
    &lt;/form&gt;
   &lt;form action="register.php" method="post"&gt;
    &lt;input type="submit" value="Register a new user" /&gt;
    &lt;/form&gt;
  
     &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>So guys I got this and my question is: I want to use sessions to assign the last registered user as the value of the login form. Everything I got runs ok the thing is if I log in for the first time and I have not started a session i get nothing for the U variable and i get an error message. How can I ... avoid that or something. I tried if statement but in the value section it does not accept {} brackets or something. Any suggestions?</p>