473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

"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 1562
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
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...
1
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"...
10
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...
0
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)...
13
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...
1
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...
4
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. ...
3
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...
2
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%;...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.