iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-04-2006, 11:09 AM
pagetta's Avatar
WebProWorld Veteran
 
Join Date: Nov 2004
Location: UK
Posts: 509
pagetta RepRank 2
Default PHP print(" - how to make it bold?

Hi I have the following php as the selected option in a drop down box in a form:

<?php if ($status != "") {print ("INCOMPLETE FIELD");} elseif ($status=="") {print ("Please Select...");} ?>

I want the INCOMPLETE FIELD part to print in bold - how do I do this? I have tried using [b] tags inside the "", but its not working. The field has a class applied to it, but nothing in that class determines the font-weight.

Any tips on how to make this bold, or a different colour?

ta
Reply With Quote
  #2 (permalink)  
Old 04-04-2006, 02:23 PM
WebProWorld Pro
 
Join Date: May 2004
Location: Austin, TX
Posts: 199
steve0 RepRank 0
Default

I don't fully understand your code logic ;) given it is a dropdown,
but for color.. just add a style attribute to the option value.
<option value="1" style="color:RED;">This One</option>

I am looking at the logic..
If status ISN'T blank it's INCOMPLETE?


<?php if ($status) {print ("<option style=\"color:RED;\" SELECTED> INCOMPLETE FIELD</option>");} elseif (!$status) {print ("Please Select...");} ?>


Let me know if I am way off base.. :)
__________________
Hardcore Programming Solutions and Coffee Drinker
Reply With Quote
  #3 (permalink)  
Old 04-05-2006, 05:57 AM
pagetta's Avatar
WebProWorld Veteran
 
Join Date: Nov 2004
Location: UK
Posts: 509
pagetta RepRank 2
Default

ok, the php script that processes the form says basically if all fields are complete, mail to tis and do this this and this etc

Otherwise, go back to this page, and the variable $status = please supply all information.

$status will only equal SOMETHING if the page has come up after not completing this field.

I don't want the text in that field to be red regardless, only if we're back on that page because the field hasn't been completed so I want red text to highlight that field isn't complete.
Reply With Quote
  #4 (permalink)  
Old 04-08-2006, 10:20 AM
WebProWorld Member
 
Join Date: Jul 2003
Location: Philadelphia
Posts: 82
dean RepRank 1
Default

If in your css file you have
.bold{font-weight: bold;}
then you could probably use
<?php if ($status != "") {print ("<span class=\"bold\">INCOMPLETE FIELD</span>");} elseif ($status=="") {print ("Please Select...");} ?>

The [b] tags may not have worked because of the doctype. ??
Reply With Quote
  #5 (permalink)  
Old 04-10-2006, 06:34 AM
pagetta's Avatar
WebProWorld Veteran
 
Join Date: Nov 2004
Location: UK
Posts: 509
pagetta RepRank 2
Default another php question

thanks dean will give that a go.
whilst on the subject of php I was wondering...
the code that mails the form says

$to = '$email';

this is so that for the time being, those testing the form can see the results and how the email will look.

if anyone within our company puts their email address in the 'email' field, it mail the results to them no problem, but the minute you put an external address (eg a hotmail or yahoo address) the mail is not delivered - any ideas why this happens or how to fix it?
thank you
Reply With Quote
  #6 (permalink)  
Old 04-10-2006, 07:40 PM
WebProWorld New Member
 
Join Date: Apr 2006
Posts: 1
kentjane RepRank 0
Default Re: another php question

Quote:
Originally Posted by pagetta
if anyone within our company puts their email address in the 'email' field, it mail the results to them no problem, but the minute you put an external address (eg a hotmail or yahoo address) the mail is not delivered - any ideas why this happens or how to fix it?
thank you
What's your content-type? html or text. Sometimes, the yahoo and msn/hotmail do not like the html type. They probably filter them down and cast them to junk mail.

My two cents :)
Reply With Quote
  #7 (permalink)  
Old 04-11-2006, 04:04 AM
chadhaajay's Avatar
WebProWorld Pro
 
Join Date: Dec 2003
Location: INDIA
Posts: 160
chadhaajay RepRank 1
Default Re: PHP print(" - how to make it bold?

Quote:
Originally Posted by pagetta
Hi I have the following php as the selected option in a drop down box in a form:

<?php if ($status != "") {print ("INCOMPLETE FIELD");} elseif ($status=="") {print ("Please Select...");} ?>

The field has a class applied to it, but nothing in that class determines the font-weight.

Any tips on how to make this bold, or a different colour?

ta
You can use the code below to make a particular option in the options drop down as bold text

<option value="xyz" style="font-weight: bold;">Your Text Here</option>
Reply With Quote
  #8 (permalink)  
Old 04-14-2006, 05:59 PM
minorgod's Avatar
WebProWorld Member
 
Join Date: Jan 2005
Posts: 84
minorgod RepRank 0
Default Re: another php question

Quote:
Originally Posted by pagetta
whilst on the subject of php I was wondering...
the code that mails the form says

$to = '$email';

this is so that for the time being, those testing the form can see the results and how the email will look.

if anyone within our company puts their email address in the 'email' field, it mail the results to them no problem, but the minute you put an external address (eg a hotmail or yahoo address) the mail is not delivered - any ideas why this happens or how to fix it?
thank you
You probably already figured this out, but your quotes are wrong. If you want the variable $email to be substituted with the value of the variable, you need to put it in double-quotes or leave the quotes out entirely. Single quotes will simply display the name of the variable, but will not trigger a substitution of the value. I'm not sure why anyone in your company is getting mail with that format unless there's another place where the recipient address is specified properly in the mail headers.

I also noticed some other code you were asking about that does some string comparison...
Code:
<?php 
if ($status != "") {
     print ("INCOMPLETE FIELD");
} elseif ($status=="") {
     print ("Please Select...");
} 
?>
This might be better written:

Code:
<?php 
if (empty($status)) {
     echo ('Please Select...');
} else {
     echo ('INCOMPLETE FIELD');
} 
?>
I like to use "echo" instead of print because it sounds so much cooler/geekier to say "echo". I don't think there's a technical difference between the two.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:08 PM.



Search Engine Optimization by vBSEO 3.3.0