Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Is there a textarea character limit in PHP

Posted on 2014-03-26
9
Medium Priority
?
401 Views
Last Modified: 2014-03-27
Hello,

I have created a form in PHP that includes a textarea.  The form information is being sent via e-mail.  Is there a character limit in textarea?

I am using PHP with Pear on a Linux server.

Please advise.

Have a great day,

Don
0
Comment
Question by:GEMCC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 39956324
I'm sure there is a browser-based limit, but it's not going to be an issue for emailed content. You will have problems sending the email long before you run into a problem with running out of room on the textarea.

If it's basic form data, you shouldn't need to really worry about limits. If anything, you may want to add the maxlength attribute to the tag and specify your own limit so that someone doesn't put in 10 megabytes of text that then gets emailed to you and sucks up your bandwidth.
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 39956335
In Php you can only truncate the textarea value after the user has submitted it to the server script. But this is not a great idea, because it lets the user believe to have sent a long text whereas a part of it is deleted on the server side.

It's better to ue javascript to set the limit of chars a user can type within the textarea. Give to your text area an id (for instance, <textarea id='mymesage'>) and then use JQuery:

$('#mymessage').on('keypress', function(){
    var limit = 255;
    if($(this).val().length > limit){
        $(this).val($(this).val().substr(0, limit));
    }
});

Open in new window

0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 39956344
No, you would normally use JavaScript to check that the users were not entering more characters than you want them to.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 31

Expert Comment

by:Marco Gasi
ID: 39956345
Lol. Unless gr8gonzo knew something I ignore, this is a perfect example of how we can interpret  in two opposite ways the same question if the asker isn't precise and descriptive enough!
0
 
LVL 35

Expert Comment

by:gr8gonzo
ID: 39956363
@Marco - true, although I would suggest that he use the maxlength attribute over Javascript if he wants to enforce a limit. I would also recommend truncating the data on the server-side, as well (just in case a malicious user posts data directly instead of using the form).
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 39956378
Practically speaking, no, there is no textarea limit.  The maximum length of the POST-method request is probably somewhere near 2 billion bytes.  If you type 60 WPM, it will take you about 12 years to exceed the maximum length.
0
 

Author Comment

by:GEMCC
ID: 39956407
Never mind.  I found the issue.  The script I was using cut the message off.

Thanks for your responses.

Have a great day,

Don
0
 

Author Closing Comment

by:GEMCC
ID: 39957796
Answered my question.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39958616
:-)  Thanks for the points and thanks for using EE, ~Ray
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question