Edit form help

My edit form shows current values in database and we can erase them and change value as we want. the problem is it doesnt show excisting value for textarea in database. Is there a anyspecial way to take the values for textarea???

this my code for the form part only
[php]

     <form ACTION="edit_chemical_save.php" name="editchemicalForm" id="editchemicalForm" METHOD="POST" align="center" >
<?php session_start(); include("config.php"); $id = $_GET['id']; $result = mysql_query("SELECT * FROM chemical WHERE id= $id") or die(mysql_error()); $row = mysql_fetch_array($result); if($row) { $generalname = $row['generalname']; $Scientificname = $row['Scientificname']; $quantity = $row['quantity']; $textarea = $row['textarea']; $date = $row['date']; $reorder = $row['reorder']; $type = $row['type']; } ?>
<tr>
  <td>Quantity</td>
  <td colspan="3"><input type="quantity" id="quantity" name="quantity" maxlength="50" value="<?php echo $quantity; ?>" />
    Expire date
    <input size="12" id="inputField" name="date" value="<?php echo $date; ?>"/></td>
</tr>
<tr>
  <td>Reorder level</td>
  <td colspan="3"><input type="reorder" id="reorder" name="reorder" maxlength="50" value="<?php echo $reorder; ?>"/></td>
</tr>
<tr>
  <td> Type </td>
  <td colspan="3"><select  name="type" id="type">
    <option value="solid"> solid </option>
    <option value="liquid"> liquid </option>
    <option value="liquid"> Gas </option>
    </select>
    <select  name="unit" id="unit">
      <option value="0"> units </option>
      <option value="Kg"> Kg </option>
      <option value="g"> g </option>
      <option value="mg"> mg </option>
      <option value="l"> l </option>
      <option value="ml"> ml </option>
      <option value="ml"> cm3 </option>
      <option value="bottles"> bottles </option>
      <option value="boxes"> boxes </option>
      
    </select></td>
</tr>
<tr>
  <td colspan="4" align="center"><input type="submit" name="button" id="button" value="Add Chemical"/>
  </td>
  
</tr>
Chemical name*
Chemical Code*
Notes
  </form>

[/php]

Well, it looks almost correct. Usually, you do a WHILE clause to read the row data. Verify that you are actually
pulling data from the query. I bet the “if($row)” is not working. After this IF clause echo one of the variables
that you pulled from the query and see if it is there or empty…

Let us know…

Sponsor our Newsletter | Privacy Policy | Terms of Service