Bolding in php?

I have set up an online form that when submited send the form in an email, I would like the questions in the output to be bolded. Is there a way that I can get these bolded?

Here is a copy of my php file: http://pastebin.com/eB9E4BLb

as an example the email I receive looks like:

Minecraft Username: Answer 1
Valid Email Address: Answer 2

I would like it to look like:

Minecraft Username: Answer 1
Valid Email Address: Answer 2

thanks,

echo ‘Minecraft Username:’; " . $_POST[‘field_1’] ."

Thank you for your help, but after using the code you suggested, this is what the email now looks like:

echo ‘Minecraft Username:’; Answer 1

It just seems to include the code instead of using it to change the output.

I don’t know if this is related but it also seems after using your code that a few of the output lines are purple instead of black, I only added your code to the first line as a test, but lines that I never added code to, are now purple in the output.

thanks,

You need to change the headers some so it knows that you’re sending out html email instead of plain text. Here’s a good tutorial on how do it and answers your question - http://css-tricks.com/sending-nice-html-email-with-php/

[php]
session_start());
$where_form_is=“http://”.$_SERVER[‘SERVER_NAME’].strrev(strstr(strrev($_SERVER[‘PHP_SELF’]),"/"));

if( ($_SESSION[‘security_code’]==$_POST[‘security_code’]) && (!empty($_POST[‘security_code’])) ) {

$headers = “From: [email protected]\r\n”; //change
$headers .= “MIME-Version: 1.0\r\n”;
$headers .= “Content-Type: text/html; charset=ISO-8859-1\r\n”;

$message = "
Registration Form:

Minecraft Username: " . $_POST[‘field_1’] . "

Valid Email Address: " . $_POST[‘field_2’] . "

When were you born?: " . $_POST[‘field_3’] . "

Which Country are you from?: " . $_POST[‘field_4’] . "

How did you find out about us?: " . $_POST[‘field_5’] . "

What do you like to do in Minecraft the most?: " . $_POST[‘field_6’] . "

What is the #1 rule of CaveExplorer.MC?: " . $_POST[‘field_7’] . "

What must you do after raiding someones farm? : " . $_POST[‘field_8’] . "

Which command are you NEVER permitted to while raiding someone elses home/base/structure?: " . $_POST[‘field_9’] . "

If you have an issue, who do you speak to? : " . $_POST[‘field_10’] . "

What are the four (4) container blocks? : " . $_POST[‘field_11’] . "

Which four (4) things should you never ask for on CaveExplorer.MC? : " . $_POST[‘field_12’] . "

What does Rule #5 mean? : " . $_POST[‘field_13’] . "

What are the ten (10) raidable blocks? : " . $_POST[‘field_14’] . "

What is pillaring and why is it bad? : " . $_POST[‘field_15’] . "

If you damage someones house, either on purpose or accidentally, what must you do before leaving that house?: " . $_POST[‘field_16’] . "

powered by phpFormGenerator.
");

mail("[email protected]",“Registration Form”, $message, $headers);
}
[/php]

Thanks for the help,

I tried the code that you provided, but it didn’t work, It also removed the confirmation page that the form had been submitted. I took a look at the link that you provided but I was unable to understand how to get it to work with the security validation.

thanks,

What i posted shouldn’t have interferred with that unless you put it in the wrong place.
[php]

<?php session_start(); $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) { $headers = "From: [email protected]\r\n"; //change the from email to match your domain $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message = "Registration Form:
Minecraft Username: " . $_POST['field_1'] . "
Valid Email Address: " . $_POST['field_2'] . "
When were you born?: " . $_POST['field_3'] . "
Which Country are you from?: " . $_POST['field_4'] . "
How did you find out about us?: " . $_POST['field_5'] . "
What do you like to do in Minecraft the most?: " . $_POST['field_6'] . "
What is the #1 rule of CaveExplorer.MC?: " . $_POST['field_7'] . "
What must you do after raiding someones farm? : " . $_POST['field_8'] . "
Which command are you NEVER permitted to while raiding someone elses home/base/structure?: " . $_POST['field_9'] . "
If you have an issue, who do you speak to? : " . $_POST['field_10'] . "
What are the four (4) container blocks? : " . $_POST['field_11'] . "
Which four (4) things should you never ask for on CaveExplorer.MC? : " . $_POST['field_12'] . "
What does Rule #5 mean? : " . $_POST['field_13'] . "
What are the ten (10) raidable blocks? : " . $_POST['field_14'] . "
What is pillaring and why is it bad? : " . $_POST['field_15'] . "
If you damage someones house, either on purpose or accidentally, what must you do before leaving that house?: " . $_POST['field_16'] . "
powered by phpFormGenerator."); mail("[email protected]","Registration Form", $message, $headers); include("confirm.html"); } else { echo "Invalid Captcha String."; } ?>[/php]

I tried the code but now I am getting the following error when submitting the form

“Parse error: syntax error, unexpected ‘)’ in /home/caveexplorer/caveexplorer.net/form/processor.php on line 27”

thanks,

I tried removing the “)” on line 27, which did fix the error, but I am not receiving any emails, I double checked the email address in the code and it is the correct email address.

thanks,

line 27 is the $message bit? if taking the ) off at the end didn’t fix it, then there’s something else going on. please post something updated code so this can figured out.

I found the problem, I had stupidly re-named the php file, and miss-spelled the file.
Thanks again for all your help, it works perfectly now.

Sponsor our Newsletter | Privacy Policy | Terms of Service