title: How can i separate php code with html to have them both clean and separate in different files?
body: <p>what i want to do is something like this </p>
  
  <pre><code>&lt;div id="login"&gt;
              &lt;h6&gt; Log in &lt;/h6&gt;
              &lt;form method="POST"&gt;
                  &lt;p&gt; Usuario: &lt;input type="text" name="user"/&gt;&lt;/p&gt;
                  &lt;p&gt; Password: &lt;input type="text" name="pass"/&gt;&lt;/p&gt;
                  &lt;input name="accion" value="login" type="hidden"/&gt;
                  &lt;input type="submit" value="Send" /&gt;
              &lt;/form&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>and i want to separate with a php code that makes me log in if you have cirtain user, what i did was :</p>
  
  <pre><code>&lt;?php
  session_start();
  if($_POST["accion"] == "login"){
      if($_POST["user"]=="root" &amp;&amp; $_POST["pass"]=="123"){
          $_SESSION["usuario"]= $_POST["user"];
          $_SESSION["time"]=time() - $_SESSION;   
          echo $_SESSION["usuario"];
      }else{  
          $error= "Usuario y/o contraseña incorrecto";
          echo $error;
      }
  }
  $logeado = isset($_SESSION["usuario"]);
  ?&gt;
  </code></pre>
  
  <p>so, how do i link this functions so that when the client hits the submit it executes this function? After that i would like to know how to change my view there if he succeeds to his username and to tell him he is logged like a message, if you can help me i'd appreciate it! thank you</p>