Current location: Hot Scripts Forums » Programming Languages » PHP » if then statement for caps or no caps


if then statement for caps or no caps

Reply
  #1 (permalink)  
Old 11-14-03, 12:18 AM
cebuy cebuy is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
if then statement for caps or no caps

This is newbie I know but I am green at this php coding...
Here is the problem...
I want to make sure that all versions of a variable's capitalization is returned. I wrote this code...
PHP Code:

if ($url_state == "CA") {

include (
'include/ca.inc');
} else {
echo 
"This is not California!";

but when "ca" is the variable, I get "This is not California" even if it is? How do I make sure all versions of California's initials are covered?

--Chris
Reply With Quote
  #2 (permalink)  
Old 11-14-03, 01:10 AM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Not sure, but try this..

if ($url_state == "CA")
{
include (
'include/ca.inc'
);
}

ifelse ($url_state == "ca")
{
include (
'include/ca.inc'
);
}

else
{
echo
"This is not California!"
;
}
Reply With Quote
  #3 (permalink)  
Old 11-14-03, 03:54 AM
Stefan's Avatar
Stefan Stefan is offline
Junior Code Guru
 
Join Date: Jun 2003
Location: Utrecht, The Netherlands
Posts: 599
Thanks: 0
Thanked 0 Times in 0 Posts
try:

PHP Code:

if (strtoupper($url_state) == "CA") {

include (
'include/ca.inc');
} else {
echo 
"This is not California!";

Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
UPDATE statement not working! aleksgurl Perl 5 11-06-03 12:40 PM
Malfunctioning switch statement and processing cstallins PHP 2 10-20-03 08:48 PM
If/else statement working...but not working mdhall PHP 13 10-16-03 08:47 AM
If then statement acting up! geneane ASP 1 09-30-03 04:32 PM
More Difficult Select Statement for Newbie bytwo ASP 2 07-01-03 04:46 AM


All times are GMT -5. The time now is 05:45 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.