...

View Full Version : why this php email not going on one line



char
03-08-2010, 05:44 PM
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
<!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
<?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

mlseim
03-08-2010, 06:45 PM
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]
";

char
03-09-2010, 12:48 PM
thank you for your help but it still seems to be only palcing the email on one line like so


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

mlseim
03-09-2010, 01:33 PM
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

SSJ
03-09-2010, 01:45 PM
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
<!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
<?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.

char
03-09-2010, 01:55 PM
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

char
03-10-2010, 12:09 PM
anyone else have any more ideas ?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum