SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2003
    Location
    sn00zeville
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Line breaks in a textarea

    I've created a form mailer wherein I have a multiline-textarea, I wanted it to have line breaks in it...
    Here's my code:

    Code for the form.html
    PHP Code:
    <form onSubmit="return checkData()" action=form.php method=post name="Honey" >
        <
    br>
        
    Name: <br>
        <
    input type=text name=name size="30" id="name">
        <
    br>
        <
    br>
        
    E-mail: <br>
        <
    input type=text name=email size="30" id="emailaddy">
        <
    br>
        <
    br>
        
    Message:<br>
        <
    textarea name=comments cols="30" rows="5" wrap="soft"></textarea>
        <
    br><br>
        <
    input type="submit" name="Submit" value="Aight!" style="background-color:white; font-size:9pt; border: 1pt solid #9933FF" >
                <
    input type="reset" name="Submit2" value="Clear" style="background-color:white; font-size:9pt; border: 1pt solid             #9933FF" >
              
    </
    form

    Here's for the form.php

    PHP Code:
    <?
    //Declare the variables
    $recipient "moi@myemail.net";
    $message "<html><body bgcolor=#242424><font color=#FF8040 size=2 face=verdana><B>Hi Honey! You have a Message!</B></font> <br><br><font color=#FFCCFF size=2 face=verdana>~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~</font><br> <font color=#FF66CC size=2 face=verdana><b>Name</b>: $name </font><br> <font color=#CC33FF size=2 face=verdana><b>Email Addy</b>: $email</font><br> <font color=#FFFF33 size=2 face=verdana><b>Message</b>: $comments <br /> </font> <br> <font color=#66CCFF size=2 face=verdana><b>IP Addy</b>: $REMOTE_ADDR </font> <br><font color=#FFCCFF size=2 face=verdana>~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~</font></font></body></html>";
    $headers="From: $name <$email> \r\n";
    $headers.= "Content-type: text/html\r\n"

    //Contents of form
    $name=$_POST['name'];
    $email=$_POST['email'];
    $comments=$_POST['comments'];
    $message stripslashes($message); 

    //mail() function sends the mail
    mail($recipient,"You have a message!",$message,$headers); 
    header("Location: sent.htm"); 
    ?>

  2. #2
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your best bet may be the nl2br function, since I presume you are attempting to send the e-mail in HTML format.
    My name is Steve, and I'm a super-villian.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •