Help please: Adding Color to what is being emailed back to m

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
FranMansfield
Forum Newbie
Posts: 2
Joined: Thu Aug 16, 2007 12:44 pm

Help please: Adding Color to what is being emailed back to m

Post by FranMansfield »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi there, 

I'm trying to make it so that the questions on the email that gets emailed back to me from my PHP form, or the answers, are in a different color. I've tried adding , or <font color="red"> </font> in various places, but it's just not working. Always gives me a parsing error. Please help....

My current code on the PHP send page:

Code: Select all

<?php

// get posted data into local variables
$EmailFrom = "xx@xx.com";
$EmailTo = "xx@xx.com";
$Subject = "Someone is emailing you info!";
$Name = Trim(stripslashes($_POST['Name'])); 
$Email = Trim(stripslashes($_POST['Email'])); 

// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}

// prepare email body text
$Body = "";
$Body .= "What is your name? ";
$Body .= $Name;
$Body .= "\n";
$Body .= "What is your email address? ";
$Body .= $Email;
$Body .= "\n";

// send email 
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page 
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>


THANK YOU!!!! Any help is greatly appreciated!!


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post by thiscatis »

A parse error will have something to do with forgetting to add \ to an " symbol.
You will need additional email headers to let make sure the mail body will be displayed as html.
FranMansfield
Forum Newbie
Posts: 2
Joined: Thu Aug 16, 2007 12:44 pm

Thanks

Post by FranMansfield »

Thanks so much. I'll look into that. Best place to look? I'm going to my PHP book first...
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Code: Select all

if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
Using PHP you can do redirects without sending HTML:

Code: Select all

if (!$validationOK) {
header("Location: error.htm");
exit;
}
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Post by JellyFish »

Also I suggest using css rather then the font tag as it is depreciated.
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post by thiscatis »

But still very often used in html mails.
Z3RO21
Forum Contributor
Posts: 130
Joined: Thu Aug 17, 2006 8:59 am

Post by Z3RO21 »

thiscatis wrote:But still very often used in html mails.
Unfortunately. I also notice many websites still using tables.
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post by thiscatis »

We have a brand new discussion about that:
viewtopic.php?t=72510
Post Reply