Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6828149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:20:57+00:00 2026-05-26T22:20:57+00:00

I have CKEditor embedded in my page. I need to prevent plain whitespaces and

  • 0

I have CKEditor embedded in my page. I need to prevent plain whitespaces and breaklines that doesn’t come with any characters. There must be at least one actual visible character.

The following answer is totally not consistent, sometimes it works fine and sometimes it does nothing, it allows whitespaces:

if(!empty($_POST['rtxt_article']))
{
    if (trim(strip_tags($_POST['rtxt_article']))) {
      // do something
    }
    else
    {
      //ops! please fill in data
    } 
}
else
{
   //ops! please fill in data
}

I also tried this:

$plainText = strip_tags($_POST['rtxt_offer']);
$isNotEmpty = trim($plainText);
if($isNotEmpty)
{
   //do something
}

When the above snippet doesn’t have effect anymore, i put ! sign and the snippet works again. After a while, the snippet doesn’t work until i remove ! and vice versa. Totally inconsistent. This is how i put !:

if(!$isNotEmpty) ...
if (!trim(strip_tags($_POST['rtxt_article']))) ...

Any idea? Any other solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:20:57+00:00Added an answer on May 26, 2026 at 10:20 pm

    Give this a shot. It will first check to see if their is actually input but using the empty() function. With adding the ! to empty() what happens is that the if statement is being asked if $_POST[‘rtxt_article’] is NOT empty, meaning that there is at least once character in it.

    if (!empty($_POST['rtxt_article']) && trim(strip_tags($_POST['rtxt_article']))) {
      // do something
    }
    

    If for some reason it is still being passed with the new line character, then you could scrub the $_POST var first.


    edited:

    $var = trim($_POST['rtxt_article']);
    if (!empty($var)) {
      // do something
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following: POST page that allows users to write text in CKEditor
We have a CKEditor in place, on a ASP.Net MVC 3 page: var editor
I have ckeditor embedded into one of my pages....but I don't know how to
I have an instance of CKEditor on a page. I am trying to give
Reading through the CKEditor documentation , I see that they have an option to
I have two CKeditor fields that are a part of the form. I have
I have a CKEditor custom plugin I'm trying to write, but need some help
I am usuing CKEditor (version 3.0.2) in a site that I built. I have
There exists an iframe plugin currently built into CKEditor that allows iframes to be
I have a form that uses CKEditor and all works. I save the text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.