473,811 Members | 3,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Hard return" causing hangups

On my website I have Guestmap that is written in PHP. I did not write
it but got it from a freeware site. Anyway it works well, except I've
discovered that if someone writes a message and uses the enter key,
that will hangup the GuestMap. There is no error message, the icons
simple will not load and no one else can enter a message.

My solution is to have PHP code remove all hard returns form the
strings before they are stored in the database. But I'm not sure what
the code would be for that. I'm sure it's easy but I don't actually
know much about PHP programming.

Anyway my website is:
www.songofthecoyote.com

Thanks for any help you can give.
Jimmy

Oct 30 '05 #1
4 1581
Jimmy Clay (www.songofthecoyote.com) wrote:
My solution is to have PHP code remove all hard returns form the
strings before they are stored in the database. But I'm not sure what
the code would be for that.


Something like this would do the trick:

$strMessage = preg_replace("/\n|\r\n|\r/", "", $strMessage);

--
http://www.phpforums.nl
Oct 30 '05 #2
That worked. Thanks

Oct 30 '05 #3
Peter van Schie wrote:
$strMessage = preg_replace("/\n|\r\n|\r/", "", $strMessage);


Isn't thie middle "\r\n" a bit redundant?

$strMessage = preg_replace("/[\r\n]", "", $strMessage);

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Oct 30 '05 #4
Toby Inkster wrote:
Peter van Schie wrote:

$strMessage = preg_replace("/\n|\r\n|\r/", "", $strMessage);

Isn't thie middle "\r\n" a bit redundant?

$strMessage = preg_replace("/[\r\n]", "", $strMessage);


True, but it does exactly the same. :)

--
http://www.phpforums.nl
Oct 30 '05 #5

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

Similar topics

10
12846
by: KENNY L. CHEN | last post by:
Dear experts, I have two tables in my Oracle 8i database: TEST (COL1,COl2,REC_NO) and TEST1 (COL1,COL2,REC_NO). Both tables are unique-indexed on (COL1,COL2,REC_NO). I think the following SQL commands will return the same result but one of my friends don't think so. He said "QUERY 1" will return 1 unsorted record (ROWNUM < 2 ) first then sort the result (ORDER BY COL1 ASC,
1
9590
by: yingjian.ma1955 | last post by:
When I want to disable the select functionality, Can I just use onselectstart="return false"? I tried it and it works. But it seems people always put onselectstart="return false" ondragstart="return false" together. What is the use of the latter part?
10
2622
by: LaEisem | last post by:
On-the-job, I have "inherited" a lot of old C language software. A question or two about when "casting" of null pointer constants is needed has occurred during behind-the-scenes cleanup of some of that software. That subject seems not to be addressed, at least not directly, in the C FAQ where FAQ 5.2 seems most relevant. References: * C FAQ 5.2 Null pointers (Including conditions where "casting" of null pointer...
0
2565
by: Joeyej | last post by:
Hi - I'm trying to move/use a web form (containing some javascript field checks) previously hosted on a Windows 2000 server. However, the FORM METHOD="post..." command in the form (shown below) now renders "Page not Found" when launched on the new Windows 2003 server (ws-server1). The form is designed to use the write.asp program to write to an Acccess database and is successful on any Windows 2000 server. This is frustrating because...
13
4013
by: kurtj | last post by:
Hello Gurus: I have a validation script (below) that is somehow messed up. If the Name field is blank, I get the alert message, then the browser window goes to a blank document with the word "false" on it. What the ?!?!?! To test, I commented out the 'return false;' code in the second IF block, so now if there is a value in Name then I get the alert message for Email and the page stays put.
1
2258
by: uli2003wien | last post by:
Dear group, i am a seasoned DB2-veteran (6 years exp.) on the Windows- and Linux-Server platform. Once in a while i had a look into DB2 on the mainframe but mostly only watching other people do the job. Currently i have an offer to go into a very big shop which runs DB2 on the mainframe (OS is not yet specified, but they talk about VSAM, so it will be no UNIX on mainframe). From my knowledge DB2 on Linux or Windows is a different...
4
8508
by: Gérard Talbot | last post by:
Hello fellow stylers, What would be the best CSS equivalent of MSIE's wrap="off" and wrap="hard"? hard Text is displayed with wordwrapping and submitted with soft returns and line feeds. off Wordwrapping is disabled. The lines appear exactly as the user types them.
3
2177
by: (PeteCresswell) | last post by:
I'm writing a little app in which people open up text files that get massaged and then used to update other files. They us Common File Dialog to navigate to the input files. I'd like to record which files were chosen, but at the \\ServerName\ShareName\DirectoryName level. Seems like the Common File Dialog will always(?) return a path that starts with a drive letter instead of the full ServerName/ShareName/DirectoryName info.
2
2142
by: Dennis | last post by:
For some reason the HTML that is being created by my ASP.Net pages (2.0) have a table like this: <table border="0" cellpadding="0" cellspacing="0" style="z-index: 103; left: 0px; width: 100%; position: absolute; top: 0px;" id="TABLE1" onclick="return TABLE1_onclick()"> This ends up causing a javascript error "Object excpected" when you click on the page because there is no TABLE1_onclick() function. Why is it doing this and what can...
0
9730
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
9605
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
10136
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...
0
9208
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
7671
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
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
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
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
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

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.