title: MVC - Submit form to controller or model
body: <p>I'm trying to apply a simple MVC pattern to my current website without any frameworks. Since i havent really gotten into oop yet im still using procedural at the moment.</p>
  
  <p>i have a simple login form (view)</p>
  
  <pre><code>&lt;form action="controller/login.php" method="Post"&gt;
  &lt;input type="text" name="username" placeholder="Username" /&gt;
  &lt;input type="text" name="password" placeholder="Password" /&gt;
  &lt;input type="submit" value="Sign in" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>this form will submit to the controller for login form. Controller will now check if both fields have inputs and "cleanse" more or less the input</p>
  
  <pre><code>if(isset($_POST['username'])){
  $username = $_POST['username'];
  $password = $_POST['password'];
  $username_escape = mysqli_real_escape_string($connect, $username);
  $password_escape = mysqli_real_escape_string($connect, $password);
  }
  
  header("../model/login.php");
  </code></pre>
  
  <p>this is a really simple check right now however i was now wondering should i include controller into model and redirect to model from controller or form submit it at first place and have controller included.</p>
  
  <p>Model</p>
  
  <pre><code>include_once("../controller/login.php");
  $query = mysqli_query($connect, "INSERT into DB_table (username, password)
  VALUES($username_escape, $password_escape)");
  </code></pre>