Feedback form in php help required

6 replies
On my website I have a feedback form that stored content of the form in the feedback table. But when people use singel quotes or double quotes in it the feedback form is giving an error. For normal text its working fine. How can I solve this problem?

Can someone help please
#feedback #form #php #required
  • Profile picture of the author Brandon Tanner
    If you convert the quotes to HTML entities as soon as the form data is submitted, it should solve the problem.

    $encodedData = htmlentities($feedbackFormData, ENT_QUOTES);

    For more info...

    PHP: htmlentities - Manual
    Signature

    {{ DiscussionBoard.errors[8264031].message }}
    • Profile picture of the author Iluminada
      Originally Posted by Brandon Tanner View Post

      If you convert the quotes to HTML entities as soon as the form data is submitted, it should solve the problem.

      = htmlentities(, ENT_QUOTES);

      For more info...

      PHP: htmlentities - Manual
      Ok But can i know when i fetch this data again then will it show as single quote or something else?
      {{ DiscussionBoard.errors[8264182].message }}
      • Profile picture of the author Brandon Tanner
        Originally Posted by Iluminada View Post

        Ok But can i know when i fetch this data again then will it show as single quote or something else?
        To decode it...

        $decodedData = html_entity_decode($encodedData);

        PHP: html_entity_decode - Manual
        Signature

        {{ DiscussionBoard.errors[8264255].message }}
        • Profile picture of the author Iluminada
          Originally Posted by Brandon Tanner View Post

          To decode it...

          = html_entity_decode();

          PHP: html_entity_decode - Manual
          ok its workign fine now , can i use same thing to send to email too? I want to send them in html format to email
          {{ DiscussionBoard.errors[8264264].message }}
          • Profile picture of the author clottedtube
            When sending to email you should check whether its in html format or not if you want to send in html format. You can specify it in mail function with header arguments
            {{ DiscussionBoard.errors[8274011].message }}
  • Profile picture of the author sktthemes
    Hello

    You can use mysql function
    mysql_real_escape_string($_POST['feedback'])
    {{ DiscussionBoard.errors[8318160].message }}

Trending Topics