473,395 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Writing data to a html textarea via php

10
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";

$fi_tbl = odbc_exec($sqlconnect, $sqlquery);
if (!$fi_tbl) {
exit("Error in SQL 1");
}

odbc_fetch_row($fi_tbl);
$ln = odbc_result($fi_tbl,"Last_Name");
$fn = odbc_result($fi_tbl,"First_Name");
$mn = odbc_result($fi_tbl,"Middle_Name");
$notes = odbc_result($fi_tbl, "NOTES");

print "notes = $notes";
print "<p>fn = $fn</p>";
print "<p>ln = $ln</p>";

odbc_close($sqlconnect);
?>

<form id="form1" name="form1" method="post" action="">
<textarea name="textarea" cols="75" rows="8" id="<?php echo $notes ?>"></textarea>
</form>
Mar 15 '07 #1
5 13238
ak1dnar
1,584 Expert 1GB
This is incorrect, you are trying to write in id attribute
[HTML]<textarea name="textarea" cols="75" rows="8" id="<?php echo $notes ?>"></textarea>[/HTML]

for most of the html form elements:
[HTML]<input type="text" name="element_name" value="<? echo $var_name; ?>" />[/HTML]

If you want to Print your PHP output variables in a HTML textarea, you can't use the ordianary way of other HTML form elements.

[HTML]<textarea name="textarea" cols="75" rows="8" id="id_goes_here"><?php echo $notes ?></textarea>[/HTML]
Mar 16 '07 #2
ak1dnar
1,584 Expert 1GB
Please note that I did not check your PHP Script to retrive Table values.
if there is Error in that please POST the errors here with your DB script.
;)
Mar 16 '07 #3
fredb
10
This is incorrect, you are trying to write in id attribute
[HTML]<textarea name="textarea" cols="75" rows="8" id="<?php echo $notes ?>"></textarea>[/HTML]

for most of the html form elements:
[HTML]<input type="text" name="element_name" value="<? echo $var_name; ?>" />[/HTML]

If you want to Print your PHP output variables in a HTML textarea, you can't use the ordianary way of other HTML form elements.

[HTML]<textarea name="textarea" cols="75" rows="8" id="id_goes_here"><?php echo $notes ?></textarea>[/HTML]
Your solution worked perfectly. Thank you very much for your help.
Mar 19 '07 #4
rpjd
25
Your solution worked perfectly. Thank you very much for your help.
I am trying to do more or less the same thing, I think. I have a html select option which calls an onclick() function. The javascript calls a file.php which in turn executes a database query retieving a value called $value. I am trying to then send the $value variable back to a text field within the HTML via javascipt. I have tried using several methods such this one, but haven't found anything that works as yet.
[code]
<input type="text" name="variable" value="<? echo $value ?>"/>
[code]
but all I get is a text field with php code. Is there a way of doing this?

RPJD :)
Mar 19 '07 #5
Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="variable" value="<?php echo $value; ?>"/>
Mar 19 '07 #6

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

Similar topics

4
by: Justin Tang | last post by:
Hi: I'm trying to pass HTML codes via a form through textarea. It seems that if I put in text larger than certain size, the data I receive through the POST array becomes var_name = . Is this a...
7
by: Anders S. Clausen | last post by:
Hi I have a jsp with a couple of <HTML:TEXTAREA> where I would like to dynamically size the textarea depending on the length of a String entered on a different jsp. The two new textareas are to...
2
by: Chris Schinzel | last post by:
Hi, I'm reading text from a html textarea field (standard wrap functionality, no value specified). If I display it via nl2br() (after html form submission), everything's ok. But if I send it via...
3
by: Junoon | last post by:
hi all, I am trying to get the values of the item selected in a select list box into a textarea, but the code is not working....Where am i going wrong???? whenever i click on any item in the...
0
by: lawrenceS59 | last post by:
Hi all, I'm fairly new to web development so bare with me. The html page that i've created isn't working and i can't figure out why. I'm guessing there are some rules that need to be followed...
1
by: shru | last post by:
Hi i need to set the focus to the end of the text displayed in the<html:textarea when the page loads... if any one knows please help me in fixing the same.....
2
by: deko | last post by:
I have a feedback form on my website with a textarea for visitors to type comments, etc. Nothing special. When users click the "Send" button, the form posts, and I copy the contents of the...
2
by: banerr2 | last post by:
I'm a beginner in C++. I'm in the process of writing an 'Automated Library Management System' using C++ on a Windows machine. I'm stuck in the midst of reading/writing data from a .csv file that...
1
by: vijaymohan | last post by:
Hi ..I am very new to perl..can some one help me with this script pls.. I am Querying database and writing data to excel.. Here is my script: #!/usr/bin/perl -w use strict; use DBI;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.