Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
How to add <hr> in php mail form?

I want to add a horizontaly line


inside a form content in php. Is that possible?

I write the code below but 'hr' looks like that in my email PR1: product1 PR2: product2 < hr > PR3: product3 PR4: product4

What should I do? Thanks !!!

   <?php
    $product1= $_POST['product1'];
    $product2= $_POST['product2'];
    $product3 = $_POST['product3'];
    $product4 = $_POST['product4'];
    
    $name = $_POST['name'];
    $email = $_POST['email'];
    
  $formcontent=" From: $name \n ST1: $product1 \n PR2: $product2 <hr> \n PR3: $product3 \n PR1: $product4";
    
    $recipient = "form@mycompany.com";
    $subject = "My Products";
    $mailheader = "From: $email \r\n";
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    echo "Thank You!" . " -" . "<a href='form.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";
    ?>
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

For <hr/> tag in your email body, you should use HTML email format, which means adding HTML tags and Content-type headers.

You can try this one

  <?php
    $product1= $_POST['product1'];
    $product2= $_POST['product2'];
    $product3 = $_POST['product3'];
    $product4 = $_POST['product4'];
    
    $name = $_POST['name'];
    $email = $_POST['email'];
    
  $formcontent="<html><body> From: $name \n ST1: $product1 \n PR2: $product2 <hr> \n PR3: $product3 \n PR1: $product4 </body></html>";
    
    $recipient = "form@mycompany.com";
    $subject = "My Products";
    $mailheader = "MIME-Version: 1.0" . "\r\n"; 
    $mailheader .= "Content-type:text/html;charset=UTF-8" . "\r\n"; 
    $mailheader .= "From: $email \r\n";

    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    echo "Thank You!" . " -" . "<a href='form.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";
    ?>
over 4 years ago · Santiago Trujillo Report

0

put content below or above following div

<div style='width:100%; height : 13px; float:left; border-bottom : 1px solid black;'>&nbsp;</div>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!