Jump to content

Recommended Posts

Hey. I just coded this simple email script. I am a beginner to html.

I have 2 problems. The first is that It will not recognize the <br /> as breaks. it just displays them in the email as "</br >". For example, if the user types "Gloss Metal" for a theme name, and then "Harry J" for developer name, and clicks submit, the email will be outputed as "Gloss Metal<br />Harry J".

 

The second problem is that it is giving me this When I click submit:

Warning: Cannot modify header information - headers already sent by (output started at /home/content/s/u/g/sug15/html/sendmail.php:6) in /home/content/s/u/g/sug15/html/sendmail.php on line 19

However, the email is still sent.

 

Here is the code for my HTML page (index.html):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Theme Upload</title>
</head>
<body>
<h2>Add your theme to our database
</h2>
<form method="post" action="sendmail.php">
  <p>Your Email:
  <br> 
    <input name="email" type="text" />
  </p>
  <p>
  Theme's name:
  <br />
    <input name="tname" type="text" size="35" />
  </p>
  <p>Developer's name:    
    <br>
    <input name="dname" type="text" size="35" />
    </p>
    <p>Theme's description:
      <br>
      <textarea name="desciption" cols="45" rows="3"></textarea>
    </p>
      <p>Screenshot link 1:    
    <br>
    <input name="ss1" type="text" size="40" />
  <p>Screenshot link 2:    
    <br>
    <input name="ss2" type="text" size="40" />
    </p>
    <p>Screenshot link 3:    
    <br>
    <input name="ss3" type="text" size="40" />
    
    <blockquote>
      <p>
        <input type="submit" /> 
         <input name="" type="reset" value="Reset" />
        </p>
    </blockquote>
</form>
 
</body>
</html>

 

Here is the code for my PHP page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
 
<p>
  <?php
  $email = $_REQUEST['email'] ;
  $tname = $_REQUEST['tname'] ;
  $dname = $_REQUEST['dname'] ;
  $description = $_REQUEST['description'] ;
  $ss1 = $_REQUEST['ss1'] ;
  $ss2 = $_REQUEST['ss2'] ;
  $ss3 = $_REQUEST['ss3'] ;
  $return = ("<br />");
  $message = $tname . $return . $dname . $return . $description . $return . $ss1 . $return . $ss2 . $return . $ss3;
 
  mail( "12345@email.com", "Theme",
    $message, "From: $email" );
  header( "Location: http://website.com/thanks.html" );
?>
 
</body>
</html>

 

And the thanks.html is just a simple html page.

 

Help, please.

Link to comment
https://forums.phpfreaks.com/topic/89279-html-not-being-recognized/
Share on other sites

 

Don't output the HTML at the top of your script before using mail() and header(). See pinned topic:

http://www.phpfreaks.com/forums/index.php/topic,37442.msg146490.html#msg146490

 

 

See "Example#4 Sending HTML email" at:

http://us3.php.net/manual/en/function.mail.php

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.