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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:13:55+00:00 2026-05-28T11:13:55+00:00

I have a customer mangement system that I have programmed in php and mysql.

  • 0

I have a customer mangement system that I have programmed in php and mysql. A company uses it to log their customer details for marketing and orders. There are various fields on my form, one of them being Business Name.

The fields are imported into an emailer to send to the customers quotes etc. The field contents are pulled in from the database and stored in various strings. Business name for example is stored in $name.

The problem I have found is if the business enters a business name such as Joe Blogs & Sons what ends being imported into the email system is Joe Blogs and that is it, anything after the ampersand is cut off, including the ampersand. If they use Joe Blogs and Sons this works fine and when the email goes out it says Dear, Joe Blogs and Sons , but if someone enters & it just ends up as Dear, Joe Blogs.

Would I be correct in saying something like str_replace or preg_replace is the way to go with this or a way to escape the &‘s ? .

  • 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-28T11:13:55+00:00Added an answer on May 28, 2026 at 11:13 am

    Use either htmlentities() or htmlspecialchars() to encode special HTML entities for injection into an HTML context. Please note that these functions are not sufficient for any other context. Example:

    Good:

    <p><?php echo htmlspecialchars($foo); ?></p>
    

    Bad:

    <a href="<?php echo htmlspecialchars($bar); ?>">Click me!</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a PHP application that uses SQLite as database management system, MySQL
We have a customer that is trying to call our web service written in
I have a customer index page that displays customer lists. I have a search
I have a customer that has set up a full backup of the database
I have a Customer class that contains a property, MyProperty, which is of a
I have a customer who is currently using Excel to do their staff planning.
We have a customer that would like to modify application user messages that we
I am writing a customer management system in PHP, for use offline (i.e. on
I have PHP application that contain three small applications. Each application have own users
The context: We’re a small company that does not have an Exchange Server (or

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.