PHP TextArea Blank Space Problem!!!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kunalm
Forum Newbie
Posts: 10
Joined: Wed Jun 27, 2007 11:25 am

PHP TextArea Blank Space Problem!!!

Post by kunalm »

patrikG | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello Gurus
                  I need a little bit of help here. I am using xamp with win xp prof sp2 as my devlopment environment. It works fine and gves me no trouble. But whenever I use a textarea tag with the following code, when I open the page which contains the form some blank spaces gets added to the text values which I display in the texarea tag(in case of editing a record). Or even when I open the blank form(to insert record), when I click or tab int the textarea control, the same problems causes me massive trouble.  

The code I am using is as follows:
Edit mode:
-------------
[syntax="php"]<textarea style="overflow:auto;font-family:Arial;font-size:12px;" name="cat_desc" rows="5" cols="50">
<?php echo "The value to display here..."; ?>
</textarea>
Insert mode:
----------------

Code: Select all

<textarea style="overflow:auto;font-family:Arial;font-size:12px;" name="cat_desc" rows="5" cols="50">
</textarea>
Any ideas why this is happenning? Please help me with something. I have been working on this but could not solve the problem on my own.

Thanks in advance for your help.[/b][/syntax]


patrikG | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
smudge
Forum Contributor
Posts: 151
Joined: Sun May 20, 2007 12:13 pm

Post by smudge »

Hi, I happened to run into this same problem before. In HTML, white space is generally ignored, but in textareas, it is not. Make sure there is no extra whitespace between your textarea tags, and that should solve the problem.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Try this:
Edit mode

Code: Select all

<textarea style="overflow:auto;font-family:Arial;font-size:12px;" name="cat_desc" rows="5" cols="50"><?php echo "The value to display here..."; ?></textarea>
Insert mode

Code: Select all

<textarea style="overflow:auto;font-family:Arial;font-size:12px;" name="cat_desc" rows="5" cols="50"></textarea> 
kunalm
Forum Newbie
Posts: 10
Joined: Wed Jun 27, 2007 11:25 am

Post by kunalm »

Thank you all for the help. The code did helped a lot. :D
Post Reply