Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if statement 1

Status
Not open for further replies.

kurie

Programmer
Jun 4, 2008
170
ZA
does anyone know why my ode isnt evaluationg to true, im still struggling with php's simple things.
$message = "ask kmobilezw kasi";
$Response = '';
$keyword =strtoupper(substr($message,13));
echo $keyword;
if ($keyword == 'KASI')
{
$Response = "Thanks for Entering the Competition The draw will be on 08 May 2009 Your RefNo is '$RefNo' T and C apply.";
}
elseif ($keyword == 'TEBS')
{
$Response = "Thanks for Entering the Competition The draw will be on 31 May 2009 Your RefNo is '$RefNo' T and C apply.";
}
echo $Response;
echo $keyword;
thanks
 
thanks excactly what i have done, its echoing KASI but it doesnt evaluate to true.
if you look at my code i have 3 echoes, all of which are displaying KASI
 
Hi

Well, not for your sample $message :
Code:
$message = "ask kmobilezw[COLOR=white red] kasi[/color]";
[gray]//          0123456789012[/gray][COLOR=silver red]34567[/color]
[gray]//                    [/gray][COLOR=white red]1[/color]
The [tt]substr()[/tt] starting on position 13 returns 5 characters.

Feherke.
 
thanks very much Feherke, it worked now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top