title: How to get the value of the text box outside foreach loop when I click the submit button?
body: <p>I have a code like this: 
  I want to know how to get the value of the textbox after i clicked the submit button because on my current code, it only gives me the last $key not all . Thanks</p>
  
  <pre><code>&lt;form&gt;
  foreach($array as $key =&gt; $values){
  echo "&lt;input type='text' name='title' value='$key'/&gt;";
  }
  &lt;input type='submit' name='submit' value='submit'/&gt;
  &lt;/form&gt;
  &lt;?php
  if(isset($_POST[''])){
      //get the result of the textbox
      $title = $_POST['title'];
  
  }
  ?&gt;
  </code></pre>