Click to See Complete Forum and Search --> : bold $message sent to email
Siddan
01-19-2005, 06:38 AM
hello
I have a ready 3 pages of php booking form and would like to have some of the text to be bold when recieving the mail
on that page you will type your name, adress , phone number etc etc and it will then be sent away to my mail
I have tried making the "name" "adress" to be bold in the mail so it will be easier to read when it is like Name Daniel when reading the mail
the script of one line looks like this which is the "second" page after the form has been sent from the first page
$message .= "Name: ".$_REQUEST['name'];
so how do I make the Name: to be bold?
LiLcRaZyFuZzY
01-19-2005, 06:59 AM
are you using the mail() function?
LiLcRaZyFuZzY
01-19-2005, 07:06 AM
if so, you ll have to send the message as html :
ur mail function :
mail($to, $subject, $message, $headers);
then it would be whatever ur want for $to and $subject,
and for $message it would be :
$message = "
<html>
<head></head>
<body>
<p><b>Name : </b>$name</p>
</body>
</html>";
and now for the $headers, you ll have to say the text is html and the encoding, is whatever u want, lets say ISO-8859-1:
$headers = "Content-type: text/html; charset=iso-8859-1\r\n";
Siddan
01-19-2005, 07:17 AM
well, the first page is strictly htm with forms and some javascript that every field needs to be filled.
the second page, which is not noticeable, is strictly php that will form the previous page into sending it neatly to the mail,,, a copy for the user and one to me
the third page is simply a thank you and that the form has been sent
so I guess it is no mail () function. The "action" when pressed the button will be directed to the strictly php page
I have 17 of these $message, (will add more) and it gets kinda pale when every font is normal weight so the ordinary bold tag wonīt work on that php page.
Siddan
01-19-2005, 07:23 AM
perhaps I have to set the variables in the header.. as you were getting into,,,
right now it looks like this:
$headers = "From: $MAILFROM\r\n"
."X-Mailer: PHP/RiderBooking\r\n"
."X-Priority: 3\r\n"
."X-MSMail-Priority: Normal\r\n";
and most of the $message forms have \n ahead... which I just noticed is for line break
Siddan
01-19-2005, 08:42 AM
well well,, guess it seems complicated to have the $message displayed in bold
Siddan
01-19-2005, 09:07 AM
gaah.. I donīt even know how to do a google search for it. I just get alot of BB board examples and some other forum but with other problems regarding bold text on the web output.... but I need it bold in the mail :/
LiLcRaZyFuZzY
01-19-2005, 11:40 AM
its weird, u want to have bold text in a mail, but then u tell me ur not sending any mail...so im really confused right now:p :confused: :D
Siddan
01-19-2005, 01:23 PM
lol, just that I donīt see any mail() function on that page
as I mentioned.. the first page is mainly htm source code with simple forms and tables
when pressed the Action button or submit then it will continue to the php page that only contains php scripts which wonīt be noticable for the user..
then the last page, not important in this matter, is a simply thank you page
2 mails will be sent automatically, 1 to me and 1 copy to the user
------------
so it is inside this php scripting page that I need to put in a command so all the $message commands will be written in bold when reading the mail
And this is how one line of one $message looks like:
$message .= "\n\nTelefon: ".$_REQUEST['telefon'];
as any php coder understands, the first Telefon is static and the second telefon is what the user had typed in the previous page
Telefon: 031-456 8764
that is how it will look in the mail
But I want it to be marked with bold like this:
Telefon: 031-456 8764
Hope it is more understandable now :p
LiLcRaZyFuZzY
01-19-2005, 04:43 PM
yep, understood, so the only solution i see is that u send ur mails as html.dont forget to declare that its html in the header-infos, and maybe u could post the php code`?
Siddan
01-19-2005, 05:48 PM
hey, you know what... it really did work. Didnīt know at first what you meant but then it hit me and I stuffed that line inside that $header... stuffed the htm tags aswell after the $message and it worked all fine.
My friend also said it has to be done with html.. just read his mail now but he was unsure how to implement it since he has never done it before
So thank you very much for your help :) cheers
LiLcRaZyFuZzY
01-20-2005, 02:30 AM
great!;)