Mysql and Textarea
| From: | sam rumaizan | Date: | Tue, 22 May 2007 13:29:43 +0000 |
| Subject: | Mysql and Textarea | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-27928@lists.php.net to get a copy of this message | ||
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 cant update the textarea?
Update button erase the old information from mysql database and replace it with nothing. Basically
it cant read what is inside the Textarea box. Why??
Read the highlighted code.
<?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"]."'");
}
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>";
}
?>
---------------------------------
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.