473,395 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

PHP easy font color question

164 100+
Okay, I know this probably going to be flat out the dumbest question anyone has seen on here, and I apologize for this.

I am using a sendmail.php script and it works just fine but for some reason I cannot figure out how to color the inputs from the form in red.. or any color for that matter. I assume this is easily done, I was just trying to use <font color=********>$q1 </font>


here is my script I am trying to get all the form responses in red.


Expand|Select|Wrap|Line Numbers
  1. <?
  2.   $q1 = $_REQUEST['q1'] ;
  3.   $q2 = $_REQUEST{'q2'} ;
  4.   $q3 = $_REQUEST{'q3'} ;
  5.   $q4 = $_REQUEST['q4'] ;
  6.   $q5 = $_REQUEST['q5'] ;
  7.   $q6 = $_REQUEST['q6'] ;
  8.   $q7 = $_REQUEST['q7'] ;
  9.   $q8 = $_REQUEST['q8'] ;
  10.   $q9 = $_REQUEST['q9'] ;
  11.   $q10 = $_REQUEST['q10'] ;
  12.   $comments = $_REQUEST['comments'] ;
  13.  
  14.   if (!isset($_REQUEST['q1'])) {
  15.     header( "Location: http://itsurvey.tblrock.com" );
  16.   }
  17.   elseif (empty($q1) || empty($q2) || empty($q3) || empty($q4) || empty($q5) || empty($q6) || empty($q7) || empty($q8) || empty($q9) || empty($q10)) {
  18.     ?>
  19.  
  20.     <html>
  21.     <head><title>Error</title></head>
  22.     <body>
  23.     <h1>Error</h1>
  24.     <p>
  25.     All of the questions must be answered before submitting your survey.  Please press your browsers back button and make sure all of them are filled in.
  26.     </p>
  27.     </body>
  28.     </html>
  29.  
  30.     <?php
  31.   }
  32.   else {
  33.  
  34.  
  35.   mail( "feedback@email.com", "Survey Response",
  36. "The overall quality of phone support: \n$q1\n\nThe overall quality of Email support: \n$q2\n\nThe overall quality of on-site support: \n$q3\n\nThe IT department responds in a timely manner: \n$q4\n\nI feel the IT Department is knowledgeable and professional: \n$q5\n\nI feel the IT Department cares about my issues: \n$q6\n\nThe IT staff understands my needs: \n$q7\n\nThe IT staff has been courteous and helpful: \n$q8\n\nThe IT staff provides complete, accurate information to me: \n$q9\n\nOverall my experiences with the IT department have been positive: \n$q10\n\nComments: \n$comments",
  37.     "From: feedback@email.com" );
  38.   header( "Location: thankyou.html" );
  39.   }
  40. ?>
  41.  

Thank you for any responses!
Jan 16 '08 #1
27 5158
stepterr
157 100+
Okay, I know this probably going to be flat out the dumbest question anyone has seen on here, and I apologize for this.

I am using a sendmail.php script and it works just fine but for some reason I cannot figure out how to color the inputs from the form in red.. or any color for that matter. I assume this is easily done, I was just trying to use <font color=********>$q1 </font>


here is my script I am trying to get all the form responses in red.


Expand|Select|Wrap|Line Numbers
  1. <?
  2.   $q1 = $_REQUEST['q1'] ;
  3.   $q2 = $_REQUEST{'q2'} ;
  4.   $q3 = $_REQUEST{'q3'} ;
  5.   $q4 = $_REQUEST['q4'] ;
  6.   $q5 = $_REQUEST['q5'] ;
  7.   $q6 = $_REQUEST['q6'] ;
  8.   $q7 = $_REQUEST['q7'] ;
  9.   $q8 = $_REQUEST['q8'] ;
  10.   $q9 = $_REQUEST['q9'] ;
  11.   $q10 = $_REQUEST['q10'] ;
  12.   $comments = $_REQUEST['comments'] ;
  13.  
  14.   if (!isset($_REQUEST['q1'])) {
  15.     header( "Location: http://itsurvey.tblrock.com" );
  16.   }
  17.   elseif (empty($q1) || empty($q2) || empty($q3) || empty($q4) || empty($q5) || empty($q6) || empty($q7) || empty($q8) || empty($q9) || empty($q10)) {
  18.     ?>
  19.  
  20.     <html>
  21.     <head><title>Error</title></head>
  22.     <body>
  23.     <h1>Error</h1>
  24.     <p>
  25.     All of the questions must be answered before submitting your survey.  Please press your browsers back button and make sure all of them are filled in.
  26.     </p>
  27.     </body>
  28.     </html>
  29.  
  30.     <?php
  31.   }
  32.   else {
  33.  
  34.  
  35.   mail( "feedback@email.com", "Survey Response",
  36. "The overall quality of phone support: \n$q1\n\nThe overall quality of Email support: \n$q2\n\nThe overall quality of on-site support: \n$q3\n\nThe IT department responds in a timely manner: \n$q4\n\nI feel the IT Department is knowledgeable and professional: \n$q5\n\nI feel the IT Department cares about my issues: \n$q6\n\nThe IT staff understands my needs: \n$q7\n\nThe IT staff has been courteous and helpful: \n$q8\n\nThe IT staff provides complete, accurate information to me: \n$q9\n\nOverall my experiences with the IT department have been positive: \n$q10\n\nComments: \n$comments",
  37.     "From: feedback@email.com" );
  38.   header( "Location: thankyou.html" );
  39.   }
  40. ?>
  41.  

Thank you for any responses!
This is what I do for my message parameter when using the mail function. Then you can use the HTML tags to do anything with the way it is displayed in the email.
[PHP]$message ="<table><tr><td><b>Heading</b></td></tr>";
$message .="<tr><td><b>Name:</b> " . $_POST['name'] . "</td></tr> ";
$message .="<tr><td><b>Phone:</b> " . $_POST['phone'] . "</td></tr> ";
$message .="<table>";[/PHP]

another benefit is then my call to the mail function is nice and clean.
[PHP]$mail = mail($to, $subject, $message, $headers);[/PHP]

Give that a try and let me know if you have any questions.
Jan 16 '08 #2
mbatestblrock
164 100+
This is what I do for my message parameter when using the mail function. Then you can use the HTML tags to do anything with the way it is displayed in the email.
[PHP]$message ="<table><tr><td><b>Heading</b></td></tr>";
$message .="<tr><td><b>Name:</b> " . $_POST['name'] . "</td></tr> ";
$message .="<tr><td><b>Phone:</b> " . $_POST['phone'] . "</td></tr> ";
$message .="<table>";[/PHP]

another benefit is then my call to the mail function is nice and clean.
[PHP]$mail = mail($to, $subject, $message, $headers);[/PHP]

Give that a try and let me know if you have any questions.
Hey that IS a great idea, I will be giving this a shot when I get to my work computer in the AM. Thanks a ton... will update tomorrow!
Jan 17 '08 #3
Markus
6,050 Expert 4TB
for emails to be formatted in HTML you have to send the right headers
[php]
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1";
[/php]
Something like that... i think.
Jan 17 '08 #4
stepterr
157 100+
for emails to be formatted in HTML you have to send the right headers
[php]
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1";
[/php]
Something like that... i think.
Markusn00b, thanks for adding that, you are right! You don't have to have the first line, but definitely the second. This is how I have my headers setup.

[PHP]$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";[/PHP]
Jan 17 '08 #5
mbatestblrock
164 100+
for emails to be formatted in HTML you have to send the right headers
[php]
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1";
[/php]
Something like that... i think.

Okay I am trying this out now, and when I try the first idea. I get

Parse error: syntax error, unexpected T_STRING in H:\share\IT\Websites\IT_Survey\counter\sendmail.ph p on line 2


I am trying to read up on the header business right now. any help is more than welcome!

thank you guys!
Jan 17 '08 #6
stepterr
157 100+
Okay I am trying this out now, and when I try the first idea. I get

Parse error: syntax error, unexpected T_STRING in H:\share\IT\Websites\IT_Survey\counter\sendmail.ph p on line 2


I am trying to read up on the header business right now. any help is more than welcome!

thank you guys!
That usually means you are missing a " ; " or something along those lines. And it might be line 1 that is actually causing the error.
Jan 17 '08 #7
mbatestblrock
164 100+
Markusn00b, thanks for adding that, you are right! You don't have to have the first line, but definitely the second. This is how I have my headers setup.

[PHP]$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";[/PHP]

So I have to say I am such a novice with PHP it is hardly funny. I tried reading up on the headers that you guys wrote about so I didnt seem like TOO much of a jerk, but I got to say I cant find squat that doesnt confuse me. I think its just a simple problem and I am reading far too complex of forums, etc.

Here is my code and what is my attempt at putting the headers .= "content....

as you can see the only thing that has a font tag on it is q1 at the very top. Once I figure just one out Ill be good.

If someone could help me out I would be forever in their debt!

Thank you!

Expand|Select|Wrap|Line Numbers
  1. <?
  2.   $q1 = <font color="red">$_REQUEST['q1']</font> ;
  3.   $q2 = $_REQUEST{'q2'} ;
  4.   $q3 = $_REQUEST{'q3'} ;
  5.   $q4 = $_REQUEST['q4'] ;
  6.   $q5 = $_REQUEST['q5'] ;
  7.   $q6 = $_REQUEST['q6'] ;
  8.   $q7 = $_REQUEST['q7'] ;
  9.   $q8 = $_REQUEST['q8'] ;
  10.   $q9 = $_REQUEST['q9'] ;
  11.   $q10 = $_REQUEST['q10'] ;
  12.   $comments = $_REQUEST['comments'] ;
  13.   $Formid = $_REQUEST['Formid'] ;
  14.   $headers .= "Content-type: text/html\r\n";
  15.  
  16.   if (!isset($_REQUEST['q1'])) {
  17.     header( "Location: http://website.com" );
  18.   }
  19.   elseif (empty($q1) || empty($q2) || empty($q3) || empty($q4) || empty($q5) || empty($q6) || empty($q7) || empty($q8) || empty($q9) || empty($q10)) {
  20.     ?>
  21.  
  22.     <html>
  23.     <head><title>Error</title></head>
  24.     <body>
  25.     <h1>Error</h1>
  26.     <p>
  27.     All of the questions must be answered before submitting your survey.  Please press your browsers back button and make sure all of them are filled in.
  28.     </p>
  29.     </body>
  30.     </html>
  31.  
  32.     <?
  33.   }
  34.   else {
  35.  
  36.  
  37.   mail( "feedback@tblrock.com", "IT Department Survey Response",
  38. "$Formid\n\nThe overall quality of phone support: \n$q1\n\nThe overall quality of Email support: \n$q2\n\nThe overall quality of on-site support: \n$q3\n\nThe IT department responds in a timely manner: \n$q4\n\nI feel the IT Department is knowledgeable and professional: \n$q5\n\nI feel the IT Department cares about my issues: \n$q6\n\nThe IT staff understands my needs: \n$q7\n\nThe IT staff has been courteous and helpful: \n$q8\n\nThe IT staff provides complete, accurate information to me: \n$q9\n\nOverall my experiences with the IT department have been positive: \n$q10\n\nComments: \n$comments",
  39.     "From: feedback@website.com");
  40.   header( "Location: thankyou.html" );
  41.  
  42.   }
  43. ?>
  44.  
Jan 17 '08 #8
stepterr
157 100+
mbatestblrock, Take a look at this stripped down example
[PHP]<?php
$to = $_POST["toEmail"];
$from = $our_email;
$subject = $_POST["subject"];
$message ="<table><tr><td><b>Website Design Inquiry</b></td></tr>";
$message .="<tr><td><b>Name: </b> " . $_POST['name'] . "</td></tr> ";
$message .="<tr><td><b>Phone:</b> " . $_POST['phone'] . "</td></tr> ";
$message .="<tr><td><b>Email:</b> " . $_POST['email'] . "</td></tr> ";
$message .="<tr><td><b>Message:</b> <br>" . $_POST['message'] . "</td></tr></table>";
// Additional headers
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$mail = mail($to, $subject, $message, $headers);
if($mail)
{
// Message sent sucessfully, do some code
}
else
{
//Message errored, do some code
}

?>[/PHP]

Now say I wanted the "Name" Field label to show up in red, I would do the following on that line.

[PHP]$message .="<tr><td><b><p style='color:#FF0000'>Name: </b></p> " . $_POST['name'] . "</td></tr> ";[/PHP]


Hopefully seeing a full example will help you out. Let me know if you have any other questions. Also, I noticed that around your q2 and q3 fields you have curly brackets"{ }" instead of "[ ]", don't forget to correct those too! :-)
Jan 17 '08 #9
mbatestblrock
164 100+
mbatestblrock, Take a look at this stripped down example
[PHP]<?php
$to = $_POST["toEmail"];
$from = $our_email;
$subject = $_POST["subject"];
$message ="<table><tr><td><b>Website Design Inquiry</b></td></tr>";
$message .="<tr><td><b>Name: </b> " . $_POST['name'] . "</td></tr> ";
$message .="<tr><td><b>Phone:</b> " . $_POST['phone'] . "</td></tr> ";
$message .="<tr><td><b>Email:</b> " . $_POST['email'] . "</td></tr> ";
$message .="<tr><td><b>Message:</b> <br>" . $_POST['message'] . "</td></tr></table>";
// Additional headers
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$mail = mail($to, $subject, $message, $headers);
if($mail)
{
// Message sent sucessfully, do some code
}
else
{
//Message errored, do some code
}

?>[/PHP]

Now say I wanted the "Name" Field label to show up in red, I would do the following on that line.

[PHP]$message .="<tr><td><b><p style='color:#FF0000'>Name: </b></p> " . $_POST['name'] . "</td></tr> ";[/PHP]


Hopefully seeing a full example will help you out. Let me know if you have any other questions. Also, I noticed that around your q2 and q3 fields you have curly brackets"{ }" instead of "[ ]", don't forget to correct those too! :-)
haha thanks for the curly notice! So what if you wanted the Name variable to be red instead of the label? I assume its the same process then?
Jan 17 '08 #10
Markus
6,050 Expert 4TB
haha thanks for the curly notice! So what if you wanted the Name variable to be red instead of the label? I assume its the same process then?
Yep!

Just wrap the
[php]
".$_POST['name']."
[/php]
With
Expand|Select|Wrap|Line Numbers
  1. <p style="...">$name</p>
  2.  
:)
Jan 17 '08 #11
stepterr
157 100+
haha thanks for the curly notice! So what if you wanted the Name variable to be red instead of the label? I assume its the same process then?

No problem! I know how much time can be wasted on little typos like that and how annoying it can be.

Yep, if I wanted the variable itself to be red then I would just put the "P" tag around the variable instead of the label like this:

[PHP]$message .="<tr><td><b>Name: </b><p style='color:#FF0000'> " . $_POST['name'] . "</p></td></tr> ";[/PHP]
Jan 17 '08 #12
Markus
6,050 Expert 4TB
No problem! I know how much time can be wasted on little typos like that and how annoying it can be.

Yep, if I wanted the variable itself to be red then I would just put the "P" tag around the variable instead of the label like this:

[PHP]$message .="<tr><td><b>Name: </b><p style='color:#FF0000'> " . $_POST['name'] . "</p></td></tr> ";[/PHP]
Sorry for stealing your thunder

:(

I get bored around here, so feel the need to but in on others...

I'm a terrible person, i know.
Jan 17 '08 #13
stepterr
157 100+
Sorry for stealing your thunder

:(

I get bored around here, so feel the need to but in on others...

I'm a terrible person, i know.
:-) No problem Markusn00b! I'm all for someone getting answers to their questions as quickly as possible no matter where the answer comes from! Besides, it looks like we were posting at the exact same time, I happen to be having a pretty slow day as well.
Jan 17 '08 #14
Markus
6,050 Expert 4TB
Haha! Bang on the same time!

What are the chances?

If only there were more not-so php inclined people around, i wouldn't be so bored and i also wouldn't have to watch seasons 1-6 of scrubs :(
Jan 17 '08 #15
stepterr
157 100+
Haha! Bang on the same time!

What are the chances?

If only there were more not-so php inclined people around, i wouldn't be so bored and i also wouldn't have to watch seasons 1-6 of scrubs :(
I値l admit that I知 just a tad bit envious that you are getting to watch scrubs right now. :-)
Jan 17 '08 #16
Markus
6,050 Expert 4TB
I値l admit that I知 just a tad bit envious that you are getting to watch scrubs right now. :-)
alluc.org is your friend ;)
Jan 17 '08 #17
stepterr
157 100+
alluc.org is your friend ;)

Many thanks! This is definitely the cure for boredom...besides message boards of course! :-)
Jan 17 '08 #18
Markus
6,050 Expert 4TB
Many thanks! This is definitely the cure for boredom...besides message boards of course! :-)
Message boards come second.. don't tell anyone i said that though

=X
Jan 17 '08 #19
stepterr
157 100+
Message boards come second.. don't tell anyone i said that though

=X

Our little secret...wait....

Meanwhile whenever mbatestblrock comes back they'll be wondering what happened with this thread! :-)
Jan 17 '08 #20
Markus
6,050 Expert 4TB
Our little secret...wait....

Meanwhile whenever mbatestblrock comes back they'll be wondering what happened with this thread! :-)
We're just getting our post counts up, so we can get higher on that board over there 8]

Alas, the meaningless banter must (?s:c)eist to exist!

I have hair to make pretty and eyes to rest.

Goodnight friend. :)
Jan 17 '08 #21
stepterr
157 100+
I have hair to make pretty and eyes to rest.
That almost sounded like a bad line that someone might use to turn down a date! Goodnight! ;-)
Jan 17 '08 #22
mbatestblrock
164 100+
Well I have to say thanks to everyone I finally got the thing going! I really need to dive deep into PHP sometime but time is seriously not on my time! I do check out the w3schools and lynda.com if you guys have anything you think might be a good tool for me throw it out!

thank so much!
Jan 17 '08 #23
Markus
6,050 Expert 4TB
That almost sounded like a bad line that someone might use to turn down a date! Goodnight! ;-)
Johnny! Get the ale; we have been discovered!
Jan 17 '08 #24
stepterr
157 100+
Well I have to say thanks to everyone I finally got the thing going! I really need to dive deep into PHP sometime but time is seriously not on my time! I do check out the w3schools and lynda.com if you guys have anything you think might be a good tool for me throw it out!

thank so much!

Glad you got it working! PHP.net is another good resource. Other than that I find I can't find something on here, I then go to google and search. Between those you should be able to get an answer.
Jan 17 '08 #25
Markus
6,050 Expert 4TB
Well I have to say thanks to everyone I finally got the thing going! I really need to dive deep into PHP sometime but time is seriously not on my time! I do check out the w3schools and lynda.com if you guys have anything you think might be a good tool for me throw it out!

thank so much!
tizag is a nice little place.

I often find it's the smaller, blog focused websites (like pbmods site) that are the best learning grounds.
Jan 17 '08 #26
stepterr
157 100+
Johnny! Get the ale; we have been discovered!
ha! I thought you were going to bed? :-)
Jan 17 '08 #27
Markus
6,050 Expert 4TB
ha! I thought you were going to bed? :-)
It seems i can't drag myself away from this place; it seems i have an inane desire to help people with their PHP dilemmas!

Not an ego issue, i hope.

:S

Note: we need smileys!
Jan 17 '08 #28

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: John | last post by:
Below is my code. It seems that no matter what I do, I cannot get the following list of places to start at the top of the cell. It is always centered in the middle of the cell. Is vAlign the...
22
by: Martin Ernst | last post by:
Hello! I wonder which font is normally used in IE (6) for windows if i use "sans-serif" as font-family. Does anybody know it? Thanks Martin
133
by: Philipp Lenssen | last post by:
Why is there no standardized and well-working way for a web-page to offer the font for download/embed it, in order to be displayed on the page? No matter what you think of the preferred font of a...
131
by: Peter Foti | last post by:
Simple question... which is better to use for defining font sizes and why? px and em seem to be the leading candidates. I know what the general answer is going to be, but I'm hoping to ultimately...
9
by: Dr John Stockton | last post by:
Assuming default set-ups and considering all reasonable browsers, whatever that may mean, what should an author expect that his readers in general will see (with visual browsers) for a page with...
9
by: Adam | last post by:
Can someone please help!! I am trying to figure out what a font is? Assume I am working with a fixed font say Courier 10 point font Question 1: What does this mean 10 point font Question 2:...
1
by: duncan352 | last post by:
I'm new to PHP and still pretty inexperienced when it comes to everything else in web development. I'm just now learning the art of style sheets, and that's where my problem is. When I apply the...
5
by: Keith | last post by:
Hello all, I have a C# Windows Forms app. It is in namespace App.GUI. It builds to Nav.exe. I have entered an application level setting using the designer. Its type is string, name is "FOO"...
8
by: Michael | last post by:
Hi, I'm trying to use a table and format it with CSS, but I cant get it to render with a border. I know this is really easy, but I can't see what I have wrong and when I search for tables and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project用lanning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.