473,799 Members | 3,442 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Text Area Forms and How Data is Stored

I'm having problems with an html textarea and how the input is
interpreted in php. For instance, new lines aren't being carried over
in my news posts.

Currently this is what i'm doing:
makenews.php takes form data from makenews.php and spits it out to the
first file that doesn't already exist of the name template
news.file.I.txt where I starts at 0 and works its way up. However, if
I enter something like the following:

"this is a test. There is a new
line between the words 'new' and 'line'"

I end up with a news post that looks like "this is a test. There is a
newline between the words 'new' and 'line'".

What is going on? You can play with the script yourself if that helps
any, i've created a copy for use by you guys at
http://www.cse.msu.edu/~meyerro3/google.php . Will post the source
codes on that page in a minute.

Oct 12 '05 #1
11 2700
There's this which could help you get what u want.
WYSIWYG....http://www.htmlarea.com/directory/Detailed/117.html

Rgds,
Gerard

Oct 12 '05 #2
Robizzle wrote:
[snip]
"this is a test. There is a new
line between the words 'new' and 'line'"

I end up with a news post that looks like "this is a test. There is a
newline between the words 'new' and 'line'".

[snip]

My guess is that you don't convert newlines to <br>'s when you show the
posts. Html doesn't show a new line if there is just a newline. It needs
a <br> tag.

Take a look at this:

www.php.net/nl2br

Hope it helps.

Zilla.
Oct 12 '05 #3
Zilla wrote:
Robizzle wrote:
[snip]
"this is a test. There is a new
line between the words 'new' and 'line'"

I end up with a news post that looks like "this is a test. There is a
newline between the words 'new' and 'line'".

[snip]

My guess is that you don't convert newlines to <br>'s when you show the
posts. Html doesn't show a new line if there is just a newline. It needs
a <br> tag.

Take a look at this:

www.php.net/nl2br

Hope it helps.


If you want to be HTML 4.01 compliant, use:

str_replace("\n ", "<BR>", $str);

instead.

--
Oli

Oct 12 '05 #4
I'm sure there is a much easier solution to this than buying that for
$199. I didn't notice this before i posted but as i'm watching the
readers try to test posts on my page, I can see that the new lines are
getting registered and they are saved in the news.file.*.txt files.

It must just be an html issue at this point. I found if I add a <pre>
tag before the body section it will work, however that changes the font
and disables some CSS stuff. Anyone know of a way to make any new line
that apprears in an html document to come thru other than pre?

Or i'd guess my other solution would be to parse the $_POST["body"]
with a fairly simple function and replace all of the new line
characters with a <br> tag. If I do go this route, what would a new
line character ==?

Oct 12 '05 #5
Thanks Zilla and Oli!

Oct 12 '05 #6
Robizzle wrote:
I end up with a news post that looks like "this is a test. There is a
newline between the words 'new' and 'line'".


There *is* a newline character, but there is not a HTML line break
("<br/>"). Have a look at the nl2br function.

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-arroba-escomposlinux-punto-org

You will be advanced socially, without any special effort on your part.

Oct 12 '05 #7
Iván Sánchez Ortega said the following on 12/10/2005 15:24:
Robizzle wrote:

I end up with a news post that looks like "this is a test. There is a
newline between the words 'new' and 'line'".

There *is* a newline character, but there is not a HTML line break
("<br/>").

^
^
Note: This is *not* an HTML line-break.
--
Oli
Oct 12 '05 #8
Oli Filth wrote:
There *is* a newline character, but there is not a HTML line break
("<br/>").

^
^
Note: This is *not* an HTML line-break.


Right, that's an *X*HTML line break. Lately I'm trying to make things
XHTML-compliant...

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-arroba-escomposlinux-punto-org

Signature has caused an exception 0E in register 0x4d6f7a333a333 120
Oct 12 '05 #9
I noticed that Message-ID: <0r************ @blackspark.esc omposlinux.org>
from Iván Sánchez Ortega
<ivansanchez[-@rroba]-escomposlinux.{[-punto-]{.org> contained the
following:
("<br/>").

^
^
Note: This is *not* an HTML line-break.


Right, that's an *X*HTML line break. Lately I'm trying to make things
XHTML-compliant...


He he, still not right...

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Oct 12 '05 #10

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

Similar topics

16
22518
by: Michael Walton | last post by:
I am trying to write some code that inserts or updates a text field in my SQL Server 2000 database. The SQL statement is created using a submit from a form, and the text is coming from a <textarea>, and therefore being placed into the SQL statement via a Request("field"). However, due to limitations in SQL Server 2000 and text fields, I can not use a simple Update or Insert command with text over 8000 bytes. Does anybody have any...
3
16882
by: polytimi8 | last post by:
Hello, I would like to know if it is possible to create a form in Access2000, which would function like a calendar for 8 operating rooms in hospital, showing which hours are those closed for a specific date. For this intersection I would like to be appeared the name of the doctor, the name of the patient and the kind of operation. Furthemore I would like this intersection to be marked in the calendar with a colour, showing that this...
14
4732
by: simonmarkjones | last post by:
Hi, I'm having a bit of trouble editing an old database that was created quite a while ago by someone else. There is a form that lets the user select a member of staff and show details about the training they have had. What im trying to add to this is an email button which emails the person selected - i've managed to be able to do grab the email and create a new email message with the coresponding email adress.
16
9380
by: Neal | last post by:
Hi, I saw the VB6 Code to do this at this link: http://www.dotnet247.com/247reference/msgs/11/56581.aspx The VB6 Code reads as follows: Private Type Rect Left As Long
9
3691
by: Aaron Smith | last post by:
I am creating a subclassed text box. I want to have a button inside the tetbox. That was the easy part. The part I can't figure out, is how you set the area for the text? If you type a string it will go underneath the button instead of stopping at the button and doing it's normal wrap functionality where it pushes the text off the one side of the textbox... How do you tell it to only use a certain area for text? Aaron -- ---
1
1964
by: truptidalia | last post by:
Hello, I am trying to add 2 RadioButtons in a form in js dynamically. I can see 2 radiobutttons, but no text. On clicking them, their is no selection. One of them is selected. I need to retrive their vakue on button click. The form is added in a div which is present in html form (that is not dynamically created). Form & all other elements are created dynamically & appended to div elemetn whch is present in html. The code is : ...
3
2666
by: jonniethecodeprince | last post by:
Hi all, I have trouble getting an array of data stored in a separate javascript file i.e. a file called books.js into a table of data for a .xhtml file. There are 50 Records in this file. There are 5 colums of data I wish to display. I want to display these records in groups of 10. Based on the fact that the records I want are located in a separate file, how can I get these details to show on the form and manipulate the data to...
16
11137
by: Neil | last post by:
I posted a few days ago that it seems to me that the Access 2007 rich text feature does not support: a) full text justification; b) programmatic manipulation. I was hoping that someone might know one way or the other whether that was true or not, or could point me to an article or help text that would. What I have seen so far online and in Access 2007 help seems to confirm the above. But that (or at least (b)) seems incredible that it...
9
2101
by: RICHARD BROMBERG | last post by:
Please bear in mind that I am a newbie. I am posting this question a second time because the responses to my earlier post were a little wide of the mark. So, here goes: I am using Access 2000 and I would like to make a data entry form (frmDataEntry) with a two text boxes. The table (tblPeople) has fields Name and Age. Both are character fields. The Form has two text boxes (txtName and txtAge)
0
9544
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
10490
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
10259
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
10238
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
9077
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
7570
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
5589
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4145
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
3
2941
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.