Menu

Is there a way to strip the html...

Help
Rick Bowen
2005-04-17
2013-06-03
  • Rick Bowen

    Rick Bowen - 2005-04-17

    The example I have shown below will probably have it stripped.  I have set up a phpformgenerator form that accepts recipes... updates a database, and sends an email listing the recipe.  Instead of generating an email with say the ingredients in a single column, I get a single block of text with "&nbsp;<br />" between the entries.

    Anything I could do to fix this?
    Thanks

    Rick

    Submitted By: XXXX XXXXX
    Email Address: XXXXX@XXXXXX.net
    Recipe Title: Red Velvet Cake
    Recipe Description: The Real Thing!
    Category: Cakes, Tortes
    Preparation Time:
    Serves:
    Ingredients: 1/2 cup shortening &nbsp;<br /> 1 1/2 cups sugar &nbsp;<br /> 2 eggs &nbsp;<br /> 1 tsp. vanilla &nbsp;<br /> 1 tsp. butter flavoring &nbsp;<br /> 1 1/2 oz. bottle of red color &nbsp;<br />

     
    • Rick Bowen

      Rick Bowen - 2005-04-23

      I have set up a phpformgenerator form that accepts recipes... updates a database, and sends an email listing the recipe. Instead of generating an email with, say,  the ingredients in a single column, I get a single block of text with html tags "&nbsp;<br />" between the entries.

      Anything I could do to fix this?
      Thanks

      Rick

      Example:

      Submitted By: XXXX XXXXX
      Email Address: XXXXX@XXXXXX.net
      Recipe Title: Red Velvet Cake
      Recipe Description: The Real Thing!
      Category: Cakes, Tortes
      Preparation Time: 
      Serves: 
      Ingredients: 1/2 cup shortening &nbsp;<br /> 1 1/2 cups sugar &nbsp;<br /> 2 eggs &nbsp;<br /> 1 tsp. vanilla &nbsp;<br /> 1 tsp. butter flavoring &nbsp;<br /> 1 1/2 oz. bottle of red color &nbsp;<br />

       
    • Randy

      Randy - 2005-05-12

      Here is how I fixed the problem...

      In the process.php file, find this line:
      $comments=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $comments);

      Change "&nbsp;<br />" to "\n".

      That small change will sufficiently fix the problem of &nbsp;<br /> showing up in your e-mail messages every time there is a carriage return.

      This fix will cause problems if you use the data.dat file to store your form entries.

      To fix the subsequent problems, find the following in the process.php file:

      $make=fopen("admin/data.dat","a");
      $to_put="";
      $to_put .= date("m.d.Y @H:i"). "|" .$name."|".$phone."|".$email."|".$method."|".$request."|".$comments."
      ";

      I changed it to the following:

      $comments2=$comments;
      $comments2=preg_replace("/(\n)/","&nbsp;<br />", $comments2);
      $comments2=stripslashes($comments2);
      $make=fopen("admin/data.dat","a");
      $to_put="";
      $to_put .= date("m.d.Y @H:i"). "|" .$name."|".$phone."|".$email."|".$method."|".$request."|".$comments2."
      ";

      The changes effectively "undo" the previous fix, so that the comments will write to the data.dat file correctly.

      I hope this helps!!!

       

Log in to post a comment.