Mysql and Textarea (Please help me figure out this problem. I' m stuck. Please help me!!! )

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm just a php beginner.
  So please be patient with my stupid questions.
   
  What am I missing in this code that causing the function can?t update the textarea?
   
  Update button erase the old information from mysql database and replace it with nothing. Basically it can?t read what is inside the Textarea box. Why??
   
  Read the highlighted code.
   
  <?php   
include ('./includes/header.html');
include( '../mysql_connect.php' );
  ?>
    </HEAD>
    <BODY>
    <TABLE ALIGN="center" BORDER="0" CELLSPACING="0" CELLPADDING="0">
      <TR ALIGN="center" VALIGN="middle">
        <TH ALIGN="center"><FONT SIZE="6" COLOR ="#310032">View
Existing Data</FONT></TH>
      </TR>
    </TABLE>
      <FORM METHOD="post" ACTION="ved.php">
<?php
$query = "SELECT DISTINCT Assign_Engineer FROM lo_data";
$result = mysql_query($query);
?>
    <BR /><BR />
    <CENTER>
      <SELECT NAME="R"><OPTION VALUE="NULL">Choose a Category:</OPTION>
<?php
while ($line = mysql_fetch_array($result))
{
    foreach ($line as $value)
    {
        echo"<OPTION VALUE='$value'";
    }
    echo ">$value</OPTION>";
}
?>
      </SELECT>
      <INPUT  TYPE="submit" NAME="Submit" VALUE="Submit Data"><BR /><BR
/>
<?php
if (isset($_REQUEST['save_assign_engineer'])) {
    $id = (int) $_REQUEST['save_assign_engineer'];
    $job_title =
mysql_real_escape_string($_REQUEST['Assign_Engineer'][' .$id . ']['Job_Title']);
    $sql = "
        UPDATE `lo_data`
        SET `Job_Title` = '" . $job_title . "'
        WHERE `ID` = " . $id;
    mysql_query($sql);
}
if (isset($_POST["R"])) {
    $result = mysql_query("SELECT * FROM  lo_data WHERE Assign_Engineer ='".$_POST["R"]."'");
}
?>
      <DIV STYLE="overflow:auto;">
        <TABLE  WIDTH="80" BORDER="1" CELLSPACING="1" CELLPADDING="3"
BORDERCOLOR="CDCB98">
          <THEAD>
            <TR STYLE="position: relative; top:
expression(this.offsetParent.scrollTop); background-color: #CDCB98;">
               <TH>ID</TH>
              <TH>Reference No</TH>
              <TH>Job Descriptions</TH>
              <TH>Category</TH>
              <TH>Assign Engineer</TH>
              <TH>Date Received</TH>
              <TH>Date Required</TH>
              <TH>Date Assigned</TH>
              <TH>Projected Completion Date</TH>
              <TH>Date Completed</TH>
              <TH>Manhour Spent</TH>
              <TH>Status</TH>
            </TR>
          </THEAD>
<?php
$num=mysql_num_rows($result);
echo $num;
while($row = mysql_fetch_array($result))
{
    echo "<TBODY>";
    echo "<TR VALIGN=\"TOP\" ALIGN=\"CENTER\">";
    echo "<TD>{$row['ID']}</TD>";
    echo "<TD>{$row['Ref_No']}</TD>";
    echo '<TD> <P><TEXTAREA NAME="Assign_Engineer[' . $row['ID'] . '][Job_Title]" ROWS="10"
    COLS="40">'.$row['Job_Title'] .'</TEXTAREA>';
    echo " <BR />";
echo '<button type="submit" name="save_assign_engineer" value="' .
$row['ID'] . '" />Updaet data</button>
';
    echo "<TD>{$row['Category']}</TD>";
    echo "<TD>{$row['Assign_Engineer']}</TD>";
    echo "<TD>{$row['Date_Received']}</TD>";
    echo "<TD>{$row['Date_Required']}</TD>";
    echo "<TD>{$row['Date_Assigned']}</TD>";
    echo "<TD>{$row['ProjectedCompletionDate']}</TD>";
    echo "<TD>{$row['Date_Completed']}</TD>";
    echo "<TD>{$row['ManhourSpent']}</TD>";
    echo "<TD>{$row['Status']}</TD>";
    echo "</TR>";
    echo"</TBODY>";
}
  ?>





       
---------------------------------
Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. 

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux