473,883 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiline Textbox Problems

Hey all, I'm having some trouble. On a page, I've got a multiline text
box. When I enter :

a
b
c
d

and hit submit (sending to my post.php page) and from post.php, echo
$_POST["info"] if shows up as a b c d. No carrige returns show. My
questions is... how can I do this? I know it's possible because I've
seen demonstrations, but can't seem to figure out how to do it.

Thanks,
IWP506

Jul 17 '05 #1
13 6086

On 18-May-2005, IW****@gmail.co m wrote:
Hey all, I'm having some trouble. On a page, I've got a multiline text
box. When I enter :

a
b
c
d

and hit submit (sending to my post.php page) and from post.php, echo
$_POST["info"] if shows up as a b c d. No carrige returns show. My
questions is... how can I do this? I know it's possible because I've
seen demonstrations, but can't seem to figure out how to do it.


The problem is the browser treats newlines as white space. Change \n to <br>
( str_replace("\n ",'<br>',$t xt) ) before you echo it to the browser.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@wil lglen.net (it's reserved for spammers)
Jul 17 '05 #2
Użytkownik "Tom Thackrey" <us***********@ nospam.com> napisał w wiadomo¶ci
news:Ee******** ***********@new ssvr14.news.pro digy.com...
The problem is the browser treats newlines as white space. Change \n to <br> ( str_replace("\n ",'<br>',$t xt) ) before you echo it to the browser.

there is a function nl2br() ;-)
also you can print tag <pre> before $txt

Jul 17 '05 #3
thanks! I'll give that a shot

-PulsarSL

Jul 17 '05 #4
IW****@gmail.co m wrote:
: Hey all, I'm having some trouble. On a page, I've got a multiline text
: box. When I enter :

: a
: b
: c
: d

: and hit submit (sending to my post.php page) and from post.php, echo
: $_POST["info"] if shows up as a b c d. No carrige returns show. My
: questions is... how can I do this? I know it's possible because I've
: seen demonstrations, but can't seem to figure out how to do it.

One issue is that the HTML in the form makes a difference to what you get
back.

The edit field can wrap the lines to display them so they look like
separate lines even if they are still on the same "physical" line (like
what a word processor does).

So, look up the various attributes for the HTML FORM input element you are
using, and try the various options to see what diference they make.
--

This space not for rent.
Jul 17 '05 #5
Hm... doesn't seem to be working. here's my code, It echos nothing.

-----

<html>
<body>
<?php
$mynotes="";
if (!($f=fopen("./posts/" . $_POST["password"] . ".txt" ,"r")))
exit("Unable to open file.");
while (!feof($f))
{
$x=fgetc($f);
//echo $x;
$mynotes=$mynot es . $x;
}
str_replace("\n ",'<br>',$mynot es);
echo $mynotes;
fclose($f);
?>

Thanks
PulsarSL

Jul 17 '05 #6
OHHH i think i need to do the str_replace before i write the file!
*lightbulb*

(dim lightbulb, but lightbulb)

Jul 17 '05 #7
You could also try using myStr = nl2br(myStr) - this is PHP's built in
function for doing what you are describing.

--
Rick - www.e-connected.com/functional/

Jul 17 '05 #8
You could also try using myStr = nl2br(myStr) - this is PHP's built in
function for doing what you are describing.

--
Rick - www.e-connected.com/

Jul 17 '05 #9
Thanks, the n12br function was just what I was looking for.

-PulsarSL

Jul 17 '05 #10

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

Similar topics

6
12753
by: Suresh Kumaran | last post by:
Hi All, Does anybody know the sytax in VB.NET to write the contents of a multiline text box to a text file? Appreciate help. Suresh
4
31073
by: Michael C | last post by:
Hi all, I'm trying to add lines to a multiline textbox. Here's what I'd like to end up with in the textbox (as an example): Line1 Line2 Line3 I've tried a couple of methods but nothing seems to be working. Code like
7
4054
by: Joel Finkel | last post by:
Folks, I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry. The problem is that only the modified data from the SingleLine TextBoxes are returned. The original data are returned for the MultiLine TextBoxes. Also, if the page is sent to the server (for validation, for instance), only the modified data for the...
2
2500
by: Enzo Marinelli | last post by:
Hello everyone I have a MultiLine TextBox, as follows <asp:TextBo Id="StreetAddress Rows="4 Runat="Server TextMode="MultiLine Width="100%"/
10
3691
by: danthman | last post by:
I have a TextBox set up as follows: <asp:TextBox ID="SubjectTextBox" TextMode="MultiLine" MaxLength="100" Columns="50" Rows="2" Wrap="true" runat="server" />
6
8065
Coldfire
by: Coldfire | last post by:
I am having problems with Maxlength of Multiline "Textbox". I have browsed alot to find the solution. Tons of javascripts have been found but they all deal with <asp:textarea >............. and not <asp:TextBox >............. and some of javascripts are 1-------------------------------------------- <script language="JavaScript">
2
3437
by: Mike | last post by:
I am trying to write a little program for my own use using VB2005 express edition. I have a list of peoples names in a file that I read into an array of strings. I am using a multiline textbox to enter new, edit existing, and view the names in the array. This all works well, but now I want to be able to select one more names from the list displayed in the multiline textbox then click a button to copy the selected names into another list so...
7
15507
by: Anil Gupte | last post by:
I have read a lot about getting lines from a multiline textbox in VB.Net. However, I cannot for the life of me figure out how to write to a multiline textbox. Basically, I have created an array of strings which I want to "paste" into a multiline textbox. Any ideas? -- Anil Gupte www.keeninc.net www.icinema.com
4
3833
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In multiLine textBox, enter moves to the next line, how can i overwrite it, so enter will move to the next control and ctrl + enter will move to the next line? Thanks, Gidi.
2
5836
by: Nathan Sokalski | last post by:
I have a multiline TextBox that I want to display the text used to create a control in an apsx file. I want each of these to be on a separate line in the TextBox. The only way I know of to place things on separate lines in a TextBox without doing it programmatically is the following: <asp:TextBox ID="txtMultiLine" runat="server" TextMode="MultiLine"> Line 1 Line 2 Line 3 </asp:TextBox>
0
9792
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11141
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
10742
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...
1
10847
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10415
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7971
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
5991
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4220
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3232
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.