473,804 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Textarea Formatting

I am using a php html form with data which is loaded from a mysql
database. Three of the fields are textareas. The data loads into these
fields fine, except that the loaded text starts at what appears to be 2
or 3 tab characters to the left. See illustration:

+---------<this is a textarea object>---------+
| This is about the way that|
|the text loads from the database field. |
| |
| |
+---------------------------------------------+

It's almost as if there's a textarea "align" property which is set to
"center" by default unless otherwise explicitly stated.

Is there some setting in the wrap property that will fix this, or should
I be looking elsewhere?

Jul 17 '05 #1
5 14799
"bonehead" a écrit le 27/11/2003 :
I am using a php html form with data which is loaded from a mysql database.
Three of the fields are textareas. The data loads into these fields fine,
except that the loaded text starts at what appears to be 2 or 3 tab
characters to the left. See illustration:

+---------<this is a textarea object>---------+
| This is about the way that|
|the text loads from the database field. |
| |
| |
+---------------------------------------------+

It's almost as if there's a textarea "align" property which is set to
"center" by default unless otherwise explicitly stated.

Is there some setting in the wrap property that will fix this, or should I be
looking elsewhere?


Are you sure your variable is not modified before (with extra spaces)?
Consider using trim() on it before.

Try using CSS to format your Textarea element.
Jul 17 '05 #2
Jedi121 wrote:
Are you sure your variable is not modified before (with extra spaces)?
Consider using trim() on it before.


Thanks for replying. Actually I should have mentioned that I am using
trim(). I tested this by placing the contents of the variable in a table
cell *without* putting it in a textarea, and it behaves correctly, which
leads me to believe that there's something about the formatting of the
textarea itself that I'm not understanding.

Here's a code snippet:

//begin snippet

$user_comments = $query_data["comments"];

<tr>
<th align="center" width="30%">
Additional Comments Regarding This Form</th>
<td width="70%"><te xtarea name="comments" rows="3" cols="50">
<?php echo trim(htmlspecia lchars($user_co mments)) ?></textarea>
</td>
</tr>

//end snippet


Jul 17 '05 #3
It's probably indentation in your PHP code. If your code looks like this

<td>
<textarea>
<?php echo $something; ?>
</textarea>
</td>

then all that space in front of <?php... will end up in the textarea. Better do this

<td>
<textarea><?p hp echo $something; ?></textarea>
</td>

bonehead <se**********@h ere.org> wrote in message news:<3F******* *******@here.or g>...
I am using a php html form with data which is loaded from a mysql
database. Three of the fields are textareas. The data loads into these
fields fine, except that the loaded text starts at what appears to be 2
or 3 tab characters to the left. See illustration:

+---------<this is a textarea object>---------+
| This is about the way that|
|the text loads from the database field. |
| |
| |
+---------------------------------------------+

It's almost as if there's a textarea "align" property which is set to
"center" by default unless otherwise explicitly stated.

Is there some setting in the wrap property that will fix this, or should
I be looking elsewhere?

Jul 17 '05 #4
On Wed, 26 Nov 2003 21:05:15 -0800, 'bonehead <se*********@he re.org>
wrote:
Jedi121 wrote:
Are you sure your variable is not modified before (with extra spaces)?
Consider using trim() on it before.


Thanks for replying. Actually I should have mentioned that I am using
trim(). I tested this by placing the contents of the variable in a table
cell *without* putting it in a textarea, and it behaves correctly, which
leads me to believe that there's something about the formatting of the
textarea itself that I'm not understanding.


Remember that your browser will collapse contiguous whitespace. View
the source to see exactly what's being sent to the browser.

--
David ( @priz.co.uk )
The Internet Prisoner Database: http://www.priz.co.uk/ipdb/
The Tarbrax Chronicle: http://www.tarbraxchronicle.com/
Jul 17 '05 #5
Chung Leong wrote:
It's probably indentation in your PHP code. [snip] Better do this

<td>
<textarea><?p hp echo $something; ?></textarea>
</td>


Thanks! This worked!

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4911
by: Piotr Wolski | last post by:
how can i format textarea? f.e.: <textarea><b>i wqant this text to be bold</b></textarea>
6
3171
by: Matt | last post by:
I have a textarea that is populated from a blob within a database. Everytime the data is pulled, however, there is always a lot of leading space characters before the actual text. It is not in the database this way, so how might I specify more formatting parameters within the textarea? Matt Williams
6
15458
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
3
2516
by: Kent | last post by:
Hi all, Thank you in advance. Here is the issue: I need to create a page that allows users to copy the contents of a MS Word document and paste them into a textarea. All fine and dandy...but the tabs. I don't need to keep the formatting, just the tabs. Is there any way to detect the tabs and change them to four spaces or something similar? If you have any other ideas please let me know. Thanks again for your help, Kent
10
3065
by: Perry van Kuppeveld | last post by:
Hi, I have a problem with formatting a table including text fields wich can contain up to 255 chars. I need a table with 3 columns: - First column 50 % over the with a rowspan of the total number of rows. - Second column 25 %, no rowspan - Third column 25 %, no rowspan
2
2469
by: Michael | last post by:
Question 1 ---------------- I am writing an advanced BBCode system for my forums and I would like to be able to find where the cursor was positioned last in the text so I could insert the BBCode there. Question 2 ---------------- Again I am writing an advanced BBCode system for my forums and I would like to make is so that when someone puts in a tag it goes bold, so
6
31457
by: Tony | last post by:
The w3schools HTML tag reference for <textarea> http://www.w3schools.com/tags/tag_textarea.asp says that the attributes 'cols' and 'rows' are REQUIRED attributes for the textarea tag. Looking at the HTML 4.01 specification I see this, too. What I'm wondering is - 'cols' & 'rows' determines the height & width of a textarea. So shouldn't that be something that is handled by CSS instead? What would be the practical consequence of leaving...
3
2120
by: LoliPopas | last post by:
I'm stupid in Javascripting, but i making php forum with BBcode. and i need help with this: <head> <script> function formatSelected(from_obj, formatting, format2) { from_obj.focus (); var w = self.document.selection.createRange (); w.text = ""+w.text+""; }
0
9704
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10562
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10319
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9132
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.