title: How to insert p tags from user inputted data
body: <p>I am setting up a form where the user will enter a memo into a textarea. That info will be inserted into a database with php. I want to output the info from the database as an html page with paragraph tags (the paragraph tags would be inserted before and after returns). Since the user is not inputting p tags when they are typing the memo, they would need to be inserted on output. Any ideas how I can accomplish this?</p>
  
  <pre><code>$query1 = "SELECT d.title, d.memo, d.time, e.first_name ";
  $query1 .= "FROM employee AS e, digital_memo AS d ";
  $query1 .= "WHERE e.employee_id = d.employee_id AND ";
  $query1 .= "d.time &gt; DATE_SUB(NOW(), INTERVAL " . $days . " HOUR)";
  $result1 = mysqli_query($connection, $query1);
  
  $data = $row["memo"];
  $paragraph_markers = array("\n\n","\n");
  $data = str_replace($paragraph_markers,'&lt;/p&gt;&lt;p&gt;',$data);
  
  while($row = mysqli_fetch_assoc($result1)){
      //output data
      echo "&lt;p&gt;&lt;span style='font-weight:700; font-size:1.2em;'&gt;" . $row["title"] . "&lt;/span&gt;";
      echo "&lt;span style='float:right; color:grey;'&gt;" . (date ('m-d-Y', strtotime($row["time"]))) ;
      echo ", " . $row["first_name"] . "&lt;/span&gt;&lt;/p&gt;" . "&lt;br/&gt;" ;
  
      echo "&lt;p&gt;" . $row["memo"] . "&lt;/p&gt;";
  
  };
  </code></pre>
  
  <p>I tried to add the query, result, and other info $data and $paragraph markers to swap \n with p tags. when it is output to html, nothing is output.
  please let me know if more info is needed or I did not explain this well? am I working along the right lines here? thanks in advance!</p>
  
  <p>figured out what I was trying to do...</p>
  
  <pre><code>$data = mysqli_fetch_assoc($result);
  
  $paragraph_markers = array("\n\n","\n");
  $data = str_replace($paragraph_markers,'&lt;/p&gt;&lt;p&gt;',$data["memo"]);
  </code></pre>