473,573 Members | 3,961 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cant show textarea notes when pulling from MySQL db

6 New Member
Hello,
I have a form that allows a user to submit notes in a textarea.

[HTML]<td><textarea name="Notes" value="" ROWS=3 COLS=35></textarea></td>[/HTML]

The notes get sent to the MySQL database correctly when I check out the database entries.

I have another form on the same page that pulls the notes field (along with some others) to display in another textarea. However, although the other fields pulled are displayed, the notes textarea remains empty. If I change the form's textarea to just text..it displays just the first word for each note stored in the database. Any ideas on how to get the full notes displayed?
Thanks.

The display form:
<form>...
<?
$i=0;
while ($i < $num) {
$TimeSheetID=my sql_result($res ult, $i, "TimeSheetI D");
$TaskDT=mysql_r esult($result,$ i,"TaskDT");
$UserName=mysql _result($result ,$i,"UserName") ;
$ClientName=mys ql_result($resu lt,$i,"LastName ");
$HoursWorked=my sql_result($res ult,$i,"HoursWo rked");
$Notes=mysql_re sult($result,$i ,"Notes");
?>

<tr>
<td><?php echo "<input name=TimeSheetI D type='text' value=$TimeShee tID id=TimeSheetID disabled='yes'/>";?></td>
<td><?php echo "<input name=TaskDT type='text' value=$TaskDT id=TaskDT disabled='yes'/>";?></td>
<td><?php echo "<input name=UserName type='text' value=$UserName id=UserName disabled='yes'/>";?></td>
<td><?php echo "<input name=ClientName type='text' value=$ClientNa me id=ClientName disabled='yes'/>";?></td>
<td><?php echo "<input name=HoursWorke d type='text' value=$HoursWor ked id=HoursWorked disabled='yes'/>";?></td>
<td><?php echo "<input name=Notes type='text' value=$Notes id=Notes disabled='yes'/>";?></td>
<td><?php echo "<input name=checkbox[] type='checkbox' value=$TimeShee tID id=checkbox[]>";?></td>
</tr>

<?php
$i++;
}
...</form>
Feb 25 '08 #1
5 2289
Markus
6,050 Recognized Expert Expert
I dont quite understand your problem..
Feb 25 '08 #2
alf8kitty
6 New Member
My issue is that i can see that the notes a user enters in the first form textarea get stored correctly to the database. But that when I try to pull that notes field from the database to display in another form..it either is blank or shows only the first word of all the text in the database (depending on if I am trying to display using a textarea or just text.

My SQL query to get the data is:
[PHP]//Connect to mysql server
include 'config.php';
include 'opendb.php';
$query="SELECT ts.TimeSheetID, ts.TaskDT, e.UserName, c.LastName, ts.HoursWorked, ts.Notes
FROM Emp_TimeSheet ts INNER JOIN Employee e ON ts.EmployeeID=e .EmployeeID
INNER JOIN Client c ON ts.ClientID=c.C lientID
WHERE e.EmployeeID='$ User' AND ts.TaskDT = '$Date'";

$result=mysql_q uery($query);
$num=mysql_numr ows($result);
mysql_close();
?>[/PHP]


Then to display the results of this SQL query in a new form i use:
[PHP]<form id="deleteHours Form" name="deleteHou rsForm" method="post" action="deleteH ours-exec.php">

<table border="1">
<tr>
<th>TimeSheetID </th>
<th>TaskDT</th>
<th>UserName</th>
<th>ClientNam e</th>
<th>HoursWorked </th>
<th>Notes</th>
<th>Delete</th>
</tr>

<?
$i=0;
while ($i < $num) {
$TimeSheetID=my sql_result($res ult, $i, "TimeSheetI D");
$TaskDT=mysql_r esult($result,$ i,"TaskDT");
$UserName=mysql _result($result ,$i,"UserName") ;
$ClientName=mys ql_result($resu lt,$i,"LastName ");
$HoursWorked=my sql_result($res ult,$i,"HoursWo rked");
$Notes=mysql_re sult($result,$i ,"Notes");
?>

<tr>
<td><?php echo "<input name=TimeSheetI D type='text' value=$TimeShee tID id=TimeSheetID disabled='yes'/>";?></td>
<td><?php echo "<input name=TaskDT type='text' value=$TaskDT id=TaskDT disabled='yes'/>";?></td>
<td><?php echo "<input name=UserName type='text' value=$UserName id=UserName disabled='yes'/>";?></td>
<td><?php echo "<input name=ClientName type='text' value=$ClientNa me id=ClientName disabled='yes'/>";?></td>
<td><?php echo "<input name=HoursWorke d type='text' value=$HoursWor ked id=HoursWorked disabled='yes'/>";?></td>
<td><?php echo "<input name=Notes type='text' value=$Notes id=Notes disabled='yes'/>";?></td>
<td><?php echo "<input name=checkbox[] type='checkbox' value=$TimeShee tID id=checkbox[]>";?></td>
</tr>

<?php
$i++;
}
?>
<tr>
<td colspan="7" align="right">< input name="delete" type="submit" id="delete" value="Delete"> </td>
</tr>



<?php
echo "</table>";

?>
</form>[/PHP]
Feb 25 '08 #3
TheServant
1,168 Recognized Expert Top Contributor
[PHP]<td><?php echo "<input name=TimeSheetI D type='text' value=$TimeShee tID id=TimeSheetID disabled='yes'/>";?></td>[/PHP]
Your values are wrong when you're displaying them. Try:
[PHP]<td><?php echo "<input name=TimeSheetI D type='text' value='".$TimeS heetID."' id=TimeSheetID disabled='yes'/>";?></td>[/PHP]

Basically, I have just pulled your variable $TimeSheetID out of the text of the echo, making it a variable again and then surrounded it with ' '
It is spaced out below as it is hard to read:
value= ' " . $TimeSheetID . " '

This might solve the problem.
Feb 25 '08 #4
alf8kitty
6 New Member
cool! thanks very much! i am new to php and was just trying different ways to get variables to display so i didn't really know the proper syntax.

Now that it works with text field - i tried to get it to work with with a textarea in the same way but failed...

why does this not work:
[PHP]<td><?php echo "<textarea name=Notes value='".$Notes ."' ROWS=3 COLS=35></textarea>";?></td>[/PHP]

while this works:
[PHP]<td><?php echo "<input name=Notes type='text' value='".$Notes ."' id=Notes disabled='yes'/>";?></td>[/PHP]

thanks for your help!
Feb 25 '08 #5
TheServant
1,168 Recognized Expert Top Contributor
The contents between <TEXTAREA ...> and </TEXTAREA> are used as the default value. So it should be:

[PHP]<td><?php echo "<textarea name=Notes ROWS=3 COLS=35>".$Note s."</textarea>"; ?></td>[/PHP]

Two pointers:
1. Everytime you can't get a function to work (like textarea), just google it and try and see what attributes/parameters it has. In this case, textarea does not have a parameter "value".
2. I suggest that you use lowercase for things like variables and tag names. Most things are case-sensitive, so you need to get a convention going for your code. I would write:
[PHP]<td><?php echo "<textarea name=notes ROWS=3 COLS=35>".$note s."</textarea>"; ?></td>[/PHP] instead.

Glad I could help ;)
Feb 26 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1849
by: TomT | last post by:
Hi, I've created a form that has a 3 fields. 2 textboxes (username & password) 1 TextArea (notes) I have linked this to an access DB. This is working well, the user enters thier Username & password, fills
6
15431
by: TomT | last post by:
Hi, I've created a form that has a 3 fields. 2 textboxes (username & password) 1 TextArea (notes) I have linked this to an access DB. This is working well, the user enters thier Username & password, fills
2
6225
by: groups | last post by:
Hello, HTML-heads. Odd problem that I haven't encountered before. This form and/or textarea is appearing to have no columns or no width to the end user. This only happens to the user on one particular setup, which I do not have. That is IE 6.0.2800.1106. It appears normal in other versions of IE and Firefox. The HTML markup is included...
4
7751
by: Keith Bentrup | last post by:
Hi all, I wrote a simple search function to find text in a textarea where not all the text is visible (ie. the text box displays 10 lines but there may be more than 1000 lines to search). I can find the text and select it using the function below, BUT I can't figure out how to have the textarea automatically scroll to the selection in...
25
1974
by: Peter Michaux | last post by:
Hi, There have been a few suggestions for changing the format of the FAQ site to make it easier to maintain. VK suggested and XML procedure. Matt Kruse suggested a wiki. I think something interactive would be good. Jim Ley pointed out wiki documentation doesn't always work well. I think a book type hierarchy of articles with user comments...
4
2292
by: MVSGuy | last post by:
Hello, I have a problem where a Notes field shows up in Access (via ODBC connection) but the value is either zero or blank in Access. I've verified the field is not zero or blank in Notes. Background - This is an existing ODBC connection from Access to Notes. For all other fields, it works fine. I've added a number field to the Notes...
4
2563
by: Nate12o6 | last post by:
Mabee you guys can help me with this. I have a form with enctype="multipart/form-data" that has a textarea in it as well as file upload. The text area is for a description of the file. If someone uses the enter key to make 2 lines in the text area when it is submitted it is stored in mysql database with (i guess) a line break \n? When i...
5
13251
by: fredb | last post by:
I am trying to write data from my database to a html textarea. I can write the data with the php print function. Below is the code. Any help you can offer is greatly appreciated. Thanks, Fred Bernstein <?php $sqlquery = "SELECT * FROM dbo.TBL_FACULTY_INFORMATION WHERE ID_NUM = $id_num";
3
2315
by: saytri | last post by:
I am displaying the contents of a textfile in a textArea. I want that when i edit this text in the textArea it is automatically saved in the textfile. I have wriitten this code, but the problem is that when i edit the text in the text Area it isn't saving it on the textfile. What do i have wrong? Thanks a lot. import java.awt.BorderLayout;...
0
7792
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7709
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8039
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8218
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6435
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5296
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3744
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1049
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.