Web Design Forum: contact form - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

contact form Rate Topic: -----

#1 User is offline   inzid 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 11
  • Joined: 26-February 11
  • Reputation: 0

Posted 21 January 2012 - 10:55 PM

Hi there . I have got my code all setup the way i want but I wish to have the body messages come up bold..


here is my code


<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_text1'];
$field_message2 = $_POST['cf_text2'];
$field_message3 = $_POST['cf_text3'];

$mail_to = 'ruscal@orcon.net.nz';
$subject = 'Message from a site visitor '.$field_name;

$body_message = 'From: '.$field_name."\n";

$body_message .= 'E-mail: '.$field_email."\n";

$body_message .='If you have a written employment agreement,
what is the name of the employer as written in that agreement:'.$field_message;

$body_message .= 'If you dont have a written employment agreement,
what is the name(s) that appear on your bank statement as paying your wages/salary: '.$field_message2;

$body_message .= 'If you dont have a written employment agreement or are not sure who pays your wages/salary,
who do you think is your employer: '.$field_message3;

$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";

$mail_status = mail($mail_to, $subject, $body_message, $headers);

if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'employee.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to ruscal@orcon.net.nz');
window.location = 'employee.html';
</script>
<?php
}
?>


I am wanting to space out the email and also add bold to the follow lines;

'If you have a written employment agreement,
what is the name of the employer as written in that agreement:

If you dont have a written employment agreement,
what is the name(s) that appear on your bank statement as paying your wages/salary: '

'If you dont have a written employment agreement or are not sure who pays your wages/salary,
who do you think is your employer: '




at the moment the email is coming out like so;


From: asdasd
E-mail: ruscal@orcon.net.nz
If you have a written employment agreement,
what is the name of the employer as written in that agreement:asdasdasdIf you dont have a written employment agreement,
what is the name(s) that appear on your bank statement as paying your wages/salary: asdasdasdIf you dont have a written employment agreement or are not sure who pays your wages/salary,
who do you think is your employer: asdasdasd


Thanks,
0

#2 User is offline   websiteprodigy 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 15
  • Joined: 16-January 12
  • Reputation: 1
  • Gender:Male
  • Location:Nottingham
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 23 January 2012 - 12:51 PM

Why not set the message up for HTML that way you could style it anyway you want.

Add this to you headers:

$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";


and the start your $body_message with

$body_message = '<html><body>';


and finish with

$body_message .= '</body></html>';


then simply add <b></b> around the text requiring styling
0

#3 User is offline   webdesigner93 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,976
  • Joined: 22-September 09
  • Reputation: 222
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 23 January 2012 - 10:37 PM

View Postwebsiteprodigy, on 23 January 2012 - 12:51 PM, said:

Why not set the message up for HTML that way you could style it anyway you want.

Add this to you headers:

$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";


and the start your $body_message with

$body_message = '<html><body>';


and finish with

$body_message .= '</body></html>';


then simply add <b></b> around the text requiring styling


theres no need to add <html><body></body></html> gotta remember any email client the message is gonna appear in these tags are already open
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users