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

  • Home
  • SEARCH
  • 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 6034057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:34:28+00:00 2026-05-23T05:34:28+00:00

I have a textarea that lets users write their own input which gets saved

  • 0

I have a textarea that lets users write their own input which gets saved into the database.

The majority of the users copy their text from word or similar program, which also copies their tabs into the textarea.

When the tabs get saved to the database it is automatically converting them to just one space.

I want to save the tabs as either proper tabs into the database or a set number of whitespaces, however I can’t catch the tabs in the first place.

This is what I have tried so far (after getting the input from the user and before saving to the database)

str_replace("\t", "    ", $string);
str_replace(chr(9), "     ", $string);

However, I can tell that the tabs aren’t even being caught because I try this:

if (strpos($string, "\t") !== false)
{
    exit("The tab was found");
}  

The ‘exit’ never gets called.

I have searched extensively for an answer to this, however I haven’t been able to find any fixes.

I would really appreciate some help on this one.

  • 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-23T05:34:28+00:00Added an answer on May 23, 2026 at 5:34 am

    Nathan Bell’s comment “Is there any pre-processing being done on the form values before you see the value?”. That got me thinking.

    I am using codeigniter as my php framework. After doing some research and looking at the source code I found that the built in security class was formatting all my tabs into a single space, like so…

    if (strpos($str, "\t") !== FALSE)
    {
        $str = str_replace("\t", ' ', $str);
    }
    

    So all I did was change the source code to this:

    if (strpos($str, "\t") !== FALSE)
    {
        $str = str_replace("\t", '      ', $str);
    }
    

    And it’s working now. So thank you Nathan and everyone else who assisted for the help!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a textarea that when a users pressed enter/return on their keyboard, I
I have a textarea input that allows users to input in more than on
I have a textarea that includes information. It has an onfocus attribute which selects
I have a simple page in a PHP/MySQL web application that lets admin users
I have a textarea and among free text input I insert some tags that
I am writing a web application that lets a user create their own forms
Lets say I have a Label, Button, or TextArea object, that contains some amount
I have a TextArea that allows user input. I also have TextInput that the
I have a textarea that I'm able to edit with the jeditable plugin but
I have an HTML textarea that is of fixed width, but variable height. I

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.