Re: Mysql and Textarea (Please help me figure out this problem. I' m stuck. Please help me!!! )
| From: | Birt.Ecplipse | Date: | Wed, 23 May 2007 10:03:32 +0000 |
| Subject: | Re: Mysql and Textarea (Please help me figure out this problem. I' m stuck. Please help me!!! ) | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-27948@lists.php.net to get a copy of this message | ||
Looks like a problem in the definition of the TEXTAREA NAME.
The echo statement is started and ended with a '
While in the $row['ID'] also a quote is used. So the echo string looks not
correct.
Try: echo '<TD> <P><TEXTAREA NAME="Assign_Engineer[' .
$row[\'ID\'] .
'][Job_Title]" ROWS="10"
""bedul"" <landavia81@gmail.com> wrote in message
news:009c01c79cf2$7310ad80$670b1e0a@mis01...
> use $_POST[your var] in this script..
> not simple but worked..
>
> other option
>
> $_HTTP_POST_VARS[your var]
>
>
> ----- Original Message -----
> From: "sam rumaizan" <samcalc@yahoo.com>
> To: <php-windows@lists.php.net>
> Sent: Wednesday, May 23, 2007 4:13 AM
> Subject: [PHP-WIN] Mysql and Textarea (Please help me figure out this
> problem. I' m stuck. Please help me!!! )
>
>
>> 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.