Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Apr 2008
    Posts
    115
    Thanks
    11
    Thanked 0 Times in 0 Posts

    why this php email not going on one line

    for some reaon when the form is filled it the data it getting send to the email address marked in the script yet what the user writes is not going on one line any ideas why as i am sure that /n was to make new lines in php

    html form code
    Code:
    <!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>Untitled Document</title>
    </head>
    <body>
    <form action="reghotel_mail.php" method="POST">
    <p>Name of Hotel:</p>
        <input name="NameofHotel" size="23">
        <p>Address: <br />
        <textarea cols="20" rows="5" name="Address"></textarea>
        <br>
        <p>Telphone:</p>
        <input name="tel" size="23">
        <p>E-mail;</p>
        <input name="email" size="23">
        <p>Website:</p>
        <input name="website" size="23">
        <p>Contact Name:</p>
        <input name="ContactName" size="23">
      </p>
      <p>About the hotel history ect: <br />
        <textarea cols="70" rows="7" name="Abouthotelhistory"></textarea>
        <br>
        <p>Please list any history of Ghosts ect <br />
        <textarea cols="70" rows="7" name="historyofGhosts"></textarea>
        <br>
        <p>What services do you offer pool gmy ect<br />
        <textarea cols="70" rows="7" name="whatservices"></textarea>
        <br>
        <p>How many rooms do you offer please state if double, twin, single, family, suite <select>
    **<option>1-10</option>
    **<option>11-25</option>
    **<option>26-50</option>
    <option>-50+</option>
    </select><br />
        <textarea cols="70" rows="7" name="howmanyrooms"></textarea>
        <br>
        <p>information about the hotel (proximity to local Attractions: <br />
        <textarea cols="70" rows="7" name="localAttractions"></textarea>
        <p>any other information: <br />
        <textarea cols="70" rows="7" name="anyotherinfo"></textarea>
        <input type="submit" value="Submit">
      </p>
    </form>
    </body>
    </html>
    the php code
    Code:
    <?php
    
    $to = "myemail@myemail.com"; //edit this line to YOUR email
    // do not edit below this line!NameofHotel
    $from = $_POST["email"];
    $NameofHotel = $_POST["NameofHotel"];
    $Address = $_POST["Address"];
    $tel = $_POST["tel"];
    $email = $_POST["email"];
    $website = $_POST["website"];
    $ContactName = $_POST["ContactName"];
    $Abouthotelhistory = $_POST["Abouthotelhistory"];
    $historyofGhosts = $_POST["historyofGhosts"];
    $whatservices = $_POST["whatservices"];
    $howmanyrooms = $_POST["howmanyrooms"];
    $localAttractions = $_POST["localAttractions"];
    $anyotherinfo = $_POST["anyotherinfo"];
    $subject = $_POST["subject"];
    $name = $_POST["name"];
    $message = $_POST["message"];
    //$messagesent = "Name: $name /nMessage: $message /nSender's IP: $HTTP_SERVER_VARS[REMOTE_ADDR]";
    $mess= "Name: $name /n Hotelname: $NameofHotel /n Address: $Address /n Telphone: $tel; /n email: $email; /n website: $website; /n Contact Name: $ContactName; /n Hotel-history:$Abouthotelhistory; /n historyofGhosts:$historyofGhosts; /n what services:$whatservices; /n localAttractions:$local Attractions; /n any other info:$anyotherinfo; /n 
    Sender's IP: $HTTP_SERVER_VARS[REMOTE_ADDR]";
    mail($to,$mess,$headers);
    echo "Form has been submitted successfully we will get back to you with in the next 24 hours";
    ?>
    any one have an ideas i just cant work this out its reall werid
    so basic the content what brack from on line it just gose on to one and of couse u cant read that when its like that.

    thank you for your help

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,546
    Thanks
    8
    Thanked 1,094 Times in 1,085 Posts
    You're putting too much thought into it.
    Just define $mess as shown below, with the carriage returns already entered.

    Like this ...

    $mess= "
    Name: $name
    Hotelname: $NameofHotel
    Address: $Address
    Telephone: $tel
    Email: $email
    website: $website
    Contact Name: $ContactName
    Hotel-history:$Abouthotelhistory
    historyofGhosts:$historyofGhosts
    what services:$whatservices
    localAttractions:$local Attractions
    any other info:$anyotherinfo
    Sender's IP: $HTTP_SERVER_VARS[REMOTE_ADDR]
    ";

  • #3
    Regular Coder
    Join Date
    Apr 2008
    Posts
    115
    Thanks
    11
    Thanked 0 Times in 0 Posts
    thank you for your help but it still seems to be only palcing the email on one line like so

    Code:
    Name: Hotelname: hotel name  Address: adress  Telephone: 02034324 Email: tazbug@gmail.com website: www.com.com Contact Name: marint is the name Hotel-history:hotle history historyofGhosts:ghosts ect what services:pool gmy and so on localAttractions: Attractions any other info:other information  Sender's IP: 99.4943940..934.
    i really dont understand this dont make sents

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,546
    Thanks
    8
    Thanked 1,094 Times in 1,085 Posts
    When I do it on my server, it puts in the carriage returns just fine.

    Oh well, put the \n\n back in ( double \n\n )
    and also know that it's \n not /n

  • #5
    SSJ
    SSJ is offline
    Regular Coder
    Join Date
    Mar 2007
    Posts
    230
    Thanks
    0
    Thanked 4 Times in 4 Posts
    Quote Originally Posted by char View Post
    for some reaon when the form is filled it the data it getting send to the email address marked in the script yet what the user writes is not going on one line any ideas why as i am sure that /n was to make new lines in php

    html form code
    Code:
    <!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>Untitled Document</title>
    </head>
    <body>
    <form action="reghotel_mail.php" method="POST">
    <p>Name of Hotel:</p>
        <input name="NameofHotel" size="23">
        <p>Address: <br />
        <textarea cols="20" rows="5" name="Address"></textarea>
        <br>
        <p>Telphone:</p>
        <input name="tel" size="23">
        <p>E-mail;</p>
        <input name="email" size="23">
        <p>Website:</p>
        <input name="website" size="23">
        <p>Contact Name:</p>
        <input name="ContactName" size="23">
      </p>
      <p>About the hotel history ect: <br />
        <textarea cols="70" rows="7" name="Abouthotelhistory"></textarea>
        <br>
        <p>Please list any history of Ghosts ect <br />
        <textarea cols="70" rows="7" name="historyofGhosts"></textarea>
        <br>
        <p>What services do you offer pool gmy ect<br />
        <textarea cols="70" rows="7" name="whatservices"></textarea>
        <br>
        <p>How many rooms do you offer please state if double, twin, single, family, suite <select>
    **<option>1-10</option>
    **<option>11-25</option>
    **<option>26-50</option>
    <option>-50+</option>
    </select><br />
        <textarea cols="70" rows="7" name="howmanyrooms"></textarea>
        <br>
        <p>information about the hotel (proximity to local Attractions: <br />
        <textarea cols="70" rows="7" name="localAttractions"></textarea>
        <p>any other information: <br />
        <textarea cols="70" rows="7" name="anyotherinfo"></textarea>
        <input type="submit" value="Submit">
      </p>
    </form>
    </body>
    </html>
    the php code
    Code:
    <?php
    
    $to = "myemail@myemail.com"; //edit this line to YOUR email
    // do not edit below this line!NameofHotel
    $from = $_POST["email"];
    $NameofHotel = $_POST["NameofHotel"];
    $Address = $_POST["Address"];
    $tel = $_POST["tel"];
    $email = $_POST["email"];
    $website = $_POST["website"];
    $ContactName = $_POST["ContactName"];
    $Abouthotelhistory = $_POST["Abouthotelhistory"];
    $historyofGhosts = $_POST["historyofGhosts"];
    $whatservices = $_POST["whatservices"];
    $howmanyrooms = $_POST["howmanyrooms"];
    $localAttractions = $_POST["localAttractions"];
    $anyotherinfo = $_POST["anyotherinfo"];
    $subject = $_POST["subject"];
    $name = $_POST["name"];
    $message = $_POST["message"];
    //$messagesent = "Name: $name /nMessage: $message /nSender's IP: $HTTP_SERVER_VARS[REMOTE_ADDR]";
    $mess= "Name: $name /n Hotelname: $NameofHotel /n Address: $Address /n Telphone: $tel; /n email: $email; /n website: $website; /n Contact Name: $ContactName; /n Hotel-history:$Abouthotelhistory; /n historyofGhosts:$historyofGhosts; /n what services:$whatservices; /n localAttractions:$local Attractions; /n any other info:$anyotherinfo; /n 
    Sender's IP: $HTTP_SERVER_VARS[REMOTE_ADDR]";
    mail($to,$mess,$headers);
    echo "Form has been submitted successfully we will get back to you with in the next 24 hours";
    ?>
    any one have an ideas i just cant work this out its reall werid
    so basic the content what brack from on line it just gose on to one and of couse u cant read that when its like that.

    thank you for your help
    I think it should be \n not /n. Just fix it and it will solve your issue.

  • #6
    Regular Coder
    Join Date
    Apr 2008
    Posts
    115
    Thanks
    11
    Thanked 0 Times in 0 Posts
    this werid when i add

    $mess= "
    Name: $name \n\n
    Hotelname: $NameofHotel \n\n
    Address: $Address\n\n
    Telephone: $tel \n\n
    Email: $email \n\n
    website: $website \n\n
    Contact Name: $ContactName \n\n
    Hotel-history:$Abouthotelhistory \n\n
    historyofGhosts:$historyofGhosts \n\n
    what services:$whatservices \n\n
    localAttractions:$local \n\n Attractions
    any other info:$anyotherinfo \n\n
    Sender's IP: $HTTP_SERVER_VARS[REMOTE_ADDR] \n\n
    ";

    i then dont get the email sent to me this really werid

  • #7
    Regular Coder
    Join Date
    Apr 2008
    Posts
    115
    Thanks
    11
    Thanked 0 Times in 0 Posts
    anyone else have any more ideas ?


  •  

    Posting Permissions

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