title: fetch row data and update textarea to insert in mysql
body: <p>I have two column <code>name</code> varchar and <code>area</code> text</p>
  
  <pre class="lang-none prettyprint-override"><code>name    area
  abc     12a
  dfg     test
  </code></pre>
  
  <p>Now I want to update each of them from my page where I input some text to the textarea fetched from tow rows.</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?
  if(isset($_POST['submit'])) {
  
      $i = 0;
      foreach($_POST['txt'] as $textarea) {
          @$val[$i] = $val[$i].$textarea;
          $i++;
      }
  
      foreach($val as $value){
      $q= mysql_query("UPDATE table_name SET name = '$value' WHERE `area` = '??'");
      echo "Success"; }
  
      $sql="select * from table_name";
      $res=mysql_query($sql);
      ?&gt;
  
      &lt;form name="form1" method="post" action="&lt;?php echo $_SERVER['PHP_SELF'];?&gt;"&gt;
      &lt;table border="1"&gt;
  
                      &lt;thead&gt;
                        &lt;tr&gt;
                          &lt;th&gt;NAME&lt;/th&gt;
                          &lt;th&gt;AREA&lt;/th&gt;                        
                      &lt;/tr&gt;
      &lt;?php while($row=mysql_fetch_assoc($res)) 
      {
      ?&gt;                            
              &lt;tr&gt;
              &lt;td&gt;&lt;?php echo $row['name']; ?&gt;&lt;/td&gt;     
              &lt;td&gt;&lt;textarea rows="4" cols="40"  name="txt[]"&gt;&lt;?php  echo $row['area']; ?&gt;    &lt;/textarea&gt;&lt;br/&gt;            
              &lt;/td&gt;             
               &lt;/tr&gt;
              &lt;tr&gt;                        
                      &lt;/tr&gt;
                  &lt;?php } ?&gt;             
  
       &lt;tr&gt;
       &lt;td&gt;&lt;input type="submit" name="submit" id="submit" value="Update" /&gt;&lt;/td&gt;
       &lt;/tr&gt;
       &lt;/table&gt;                
       &lt;/form&gt;  
  </code></pre>
  
  <p>I am getting the name but could not update/insert it in <code>area</code> for that name.  How do I accomplish this?</p>