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 8632641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:22:49+00:00 2026-06-12T09:22:49+00:00

I am trying to retrieve data from the db in an input field through

  • 0

I am trying to retrieve data from the db in an input field through PHP. Instead of the placeholder, I want to display this retrieved value in the input field if the data exists. I am able to retrieve the data from the db, but it is adding few extra tabs before the actual input.

<input type="text" name="title" id="title"  value="
<?php  
    $title='title';
    $clean = trim(retrieve_project_info($email,$title));
    echo $clean;
?>">

So, if the input in the db is ‘coldplay’. the retrieved data looks like ‘[tab][tab][tab]coldplay’ and the url has many %09s in it.

I have removed whitespaces by using the trim method. But, trim does not remove tabs.
Any idea how to remove these tabs?

  • 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-06-12T09:22:50+00:00Added an answer on June 12, 2026 at 9:22 am

    Yes, removing tabs is easy, but you better find out why they are there instead of removing them.
    But your code:

    <input type="text" name="title" id="title"  value="
    <?php  
        $title='title';
        $clean = trim(retrieve_project_info($email,$title));
        echo $clean;
    ?>">
    

    would be better written like this:

    <?php  
        $title='title';
        $clean = trim(retrieve_project_info($email,$title));    
    ?>
    <input type="text" name="title" id="title"  value="<?php echo $clean; ?>">
    

    Does that help removing your tabs?
    The reason I suggest this is because retrieve_project_info could output the tabs.

    One more observation: If $clean contains ” will your code fail?

    EDIT: @palmi

    This is how I do it:

    function doFormSafeHTMLEncode($someStr){
        return htmlspecialchars($someStr,ENT_QUOTES,'UTF-8'); 
    }
    

    And I call that function everywhere where I output raw code to a formfield.

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

Sidebar

Related Questions

I am trying to retrieve a value from a hidden field. This code worked
Iam trying to retrieve data from mysql database into stylesheet.php but it is not
I'm trying to retrieve data from a php file named return that just contains
I am trying to retrieve data from mysql then display it on android listview.
I'm trying to implement an autocomplete field. I want this autocomplete to retrieve the
I'm trying to retrieve JSON data from servlet and display in html. I was
I am trying to populate a Postcode (ie zipcode) input field with data from
I’m trying to retrieve data from an entity and populate a viewModel property like
I'm trying to retrieve data from an Entity in Core Data where I know
I'm trying to retrieve data from two tables, 'publisher' and 'magazine'. I'm listing the

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.