How to Allow & to be used in form submission

Discussion in 'PHP' started by subtilty, Oct 18, 2007.

  1. #1
    Hi Guys,

    My first post here and I am still learning PHP so bare with me :)

    I have a html form that submits to a php script which prints out the results into an email ready to send.

    However if someone uses an Ampersand (&) in a company for example AT&T the script stops after the &.

    Could you help me on how to change the script so it allows the character to de displayed and completes the script correctly?

    Thanks Guys!

    James
     
    subtilty, Oct 18, 2007 IP
  2. liam1412

    liam1412 Active Member

    Messages:
    387
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #2
    You can clean the form input using

    htmlspecialchars($input);

    Then where anyone inputs & it will turn it into &. When displayed in the e-mail this will still be &

    TBF you shoudl be cleaning your data anyway to prevent sql injection.

    If this is no help please PM me full details and I will be more than happy to help for a bit of rep LOL
     
    liam1412, Oct 18, 2007 IP