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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:43:26+00:00 2026-05-27T19:43:26+00:00

A user enters URLs in a box like this: google.net google.com I then try

  • 0

A user enters URLs in a box like this:

  1. google.net
  2. google.com

I then try to validate / check the URLs, so:

function check_input($data) {
    $data = trim($data);
    $data = mysql_real_escape_string($data);
    return $data;
}

After validation:

$flr_array = explode("\n", $flr_post);

So, I can validate each URL. But mysql_real_escape_string finds spaces between URLs and adds:

<--print_r information-->
google.net\r\ngoogle.com

My URLs should and look like these:

  1. google.net
  2. google.com

How do I remove \r, because it breaks everything else?
Is there a better way to validate URLs?

Tried with str_replace, but no luck.

  • 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-27T19:43:26+00:00Added an answer on May 27, 2026 at 7:43 pm

    Thats where difference between single and double quotes comes into picture:

    $flr_array = explode('\r\n', $flr_post);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When a user enters a URL, e.g. http://www.google.com , I would like to be
I want to validate the value a user enters in a text box, so
Here's user story: User enters address: Paris, France. Then I would like to display
Well, I'm trying to make ASP.NET urls looking user-friendly, like it was explained in
I am using this regular expression to validate youtube urls. ^http:\/\/(?:www\.)?youtube.com\/watch\?(?=.*v=\w+)(?:\S+)?$ it works great.
How to handle invalid URLs in MVC? For ex.: When the user enters http://localhost/User/MyProfile
I'm using GWT with GAE. When the user enters any of the following urls,
I would like to intercept any URL which the user enters in their browser
The user enters the site. At this point, the div is in the middle
I'm writing a program where an user can enter list of URLs to load

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.