title: edit and update text area in php
body: <p>my php function is not working when im add my text area in form. other all input or working. if im add  <strong>remark(text area)</strong> in form edit function cant show text in that remark. other input is visible but i cant save it again</p>
  
  <p>please help me to fined my error   </p>
  
  <p><strong>Code before "html"</strong>  </p>
  
  <pre><code>&lt;?php
  
  function renderForm($id, $vehicle_type, $duration, $amount,$remarks, $error)
  
  {
  
  ?&gt;
  </code></pre>
  
  <p><strong>my HTML form</strong></p>
  
  <pre><code>&lt;form action=""  method="post"&gt; 
                  &lt;div class="row"&gt;
                  &lt;input type="hidden" name="id" value="&lt;?php echo $id; ?&gt;"/&gt;
                          &lt;div class="col-lg-4 col-xs-6" class="form-group"&gt;
                      &lt;label&gt;Vehicle Type &lt;span style="color:red;font-size:8px;"&gt;&lt;i class="fa fa-asterisk" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;&lt;/label&gt;
                          &lt;select name="vehicle_type" class="form-control"&gt;
                          &lt;option &lt;?php echo ($vehicle_type=='Bicycle')?'selected':'' ?&gt;&gt;Bicycle&lt;/option&gt;
                          &lt;option &lt;?php echo ($vehicle_type=='Bike')?'selected':'' ?&gt;&gt;Bike &lt;/option&gt;
                          &lt;option &lt;?php echo ($vehicle_type=='Cars')?'selected':'' ?&gt;&gt;Cars &lt;/option&gt;
                          &lt;option &lt;?php echo ($vehicle_type=='Truck')?'selected':'' ?&gt;&gt;Truck&lt;/option&gt;
                          &lt;option &lt;?php echo ($vehicle_type=='Others')?'selected':'' ?&gt;&gt;Others&lt;/option&gt;
  
                      &lt;/select&gt;
                      &lt;/div&gt;
  
  
                      &lt;div class="col-lg-4 col-xs-6" class="form-group"&gt;
                      &lt;label&gt;Duration &lt;/label&gt; &lt;span style="color:red; font-size:8px; "&gt;&lt;i class="fa fa-asterisk" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;
                                        &lt;input type="text" value="&lt;?php echo $duration; ?&gt;" name="duration" class="form-control" maxlength="20" placeholder="Eg:  4 Hrs"&gt;
                          &lt;/div&gt;
  
                          &lt;div class="col-lg-4 col-xs-6" class="form-group"&gt;
                          &lt;label&gt;&lt;i class="fa fa-inr" aria-hidden="true"&gt;&lt;/i&gt; Amount&lt;/label&gt; &lt;span style="color:red;font-size:8px;"&gt;&lt;i class="fa fa-asterisk" aria-hidden="true"&gt;&lt;/i&gt;&lt;/span&gt;
                          &lt;input type="number" name="amount" value="&lt;?php echo $amount; ?&gt;" class="form-control"  placeholder="00"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                          &lt;div class="row"&gt;
                            &lt;div class="col-lg-4 col-xs-6" class="form-group"&gt;
  
                             &lt;label&gt;Remarks&lt;/label&gt;
                              &lt;textarea class="form-control" name="remarks" &lt;?php echo htmlspecialchars($remarks); ?&gt; rows="3" placeholder="Enter ..."&gt;&lt;/textarea&gt;
                              &lt;/div&gt;
  
  
                           &lt;div id="butn"  class="col-lg-3 col-xs-3"&gt;
                           &lt;button class="myButton" type="submit" name="submit"  value="Submit" class="btn btn-block btn-success btn-lg"&gt;SAVE&lt;/button&gt;
                           &lt;/div&gt;
  
                          &lt;/div&gt;
              &lt;/form&gt; 
  </code></pre>
  
  <p><strong>Code after "html"</strong></p>
  
  <pre><code>&lt;?php
  
  }
  
  
  
  
  
  
  
  // connect to the database
  
  include('connection.php');
  
  
  
  
  
  // check if the form has been submitted. If it has, process the form and save it to the database
  
  if (isset($_POST['submit']))
  
  {
  
  // confirm that the 'id' value is a valid integer before getting the form data
  
  if (is_numeric($_POST['id']))
  
  {
  
  // get form data, making sure it is valid
  
  $id = $_POST['id'];
  
  $vehicle_type = mysql_real_escape_string(htmlspecialchars($_POST['vehicle_type']));
  
  $duration = mysql_real_escape_string(htmlspecialchars($_POST['duration']));
  
  $amount = mysql_real_escape_string(htmlspecialchars($_POST['amount']));
  
  $remarks = mysql_real_escape_string(htmlspecialchars($_POST['remarks']));
  
  
  
  
  
  if ($vehicle_type=='' || $duration=='' || $amount=='' || $remarks=='')
  
  {
  
  // generate error message
  
  $error = 'ERROR: Please fill in all required fields!';
  
  
  
  //error, display form
  
  renderForm($id, $vehicle_type, $duration, $amount, $remarks, $error);
  
  }
  
  else
  
  {
  
  // save the data to the database
  
  mysql_query("UPDATE price_normal SET vehicle_type='$vehicle_type', duration='$duration', amount='$amount', remarks='$remarks', WHERE id='$id'")
  
  or die(mysql_error());
  
  
  
  // once saved, redirect back to the view page
  
  header("Location: pnormal.php");
  
  }
  
  }
  
  else
  
  {
  
  // if the 'id' isn't valid, display an error
  
  echo 'Error!';
  
  }
  
  }
  
  else
  
  
  {
  
  
  
  // get the 'id' value from the URL (if it exists), making sure that it is valid (checing that it is numeric/larger than 0)
  
  if (isset($_GET['id']) &amp;&amp; is_numeric($_GET['id']) &amp;&amp; $_GET['id'] &gt; 0)
  
  {
  
  // query db
  
  $id = $_GET['id'];
  
  $result = mysql_query("SELECT * FROM price_normal WHERE id=$id")
  
  or die(mysql_error());
  
  $row = mysql_fetch_array($result);
  
  
  
  // check that the 'id' matches up with a row in the databse
  
  if($row)
  
  {
  
  
  
  // get data from db
  
  $vehicle_type = $row['vehicle_type'];
  
  $duration = $row['duration'];
  
  $amount = $row['amount'];
  
  $remarks = $row['remarks'];
  
  
  
  
  
  // show form
  
  renderForm($id, $vehicle_type, $duration, $amount, $remarks,'');
  
  }
  
  else
  
  // if no match, display result
  
  {
  
  echo "No results!";
  
  }
  
  }
  
  else
  
  // if the 'id' in the URL isn't valid, or if there is no 'id' value, display an error
  
  {
  
  echo 'Error!';
  
  }
  
  }
  
  ?&gt;
  </code></pre>