Sorry outlook screwed my code a bit
Dear Frank
You probably need to get a book, but here are two examples, one using if statements,
and the other using the switch/case statement.
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
//initialise the $total
$total = 51;
//$TotalString = the return of the function. Pass $total to the function
$TotalString = Price($total);
//Display the total
echo $TotalString;
function Price($ftotal)
{
//add 5 to the function
if ($ftotal <= 30)
{
$ftotal *= 3200;
}
else if($ftotal <= 50)
{
$ftotal *= 4500;
}
else
{
$ftotal *= 6500;
}
//return the value to $TotalString
return $ftotal;
}
?>
</body>
</html>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
//initialise the $total
$total = 51;
//$TotalString = the return of the function. Pass $total to the function
$TotalString = Price($total);
//Display the total
echo $TotalString;
function Price($ftotal)
{
switch($ftotal)
{
case $ftotal <= 30:
$ftotal *= 3200;
break;
case $ftotal <= 50:
$ftotal *= 4500;
break;
default:
$ftotal *= 6500;
}
//return the value to $TotalString
return $ftotal;
}
?>
</body>
</html>
--
Kind Regards
David
Anagram Systems
http://www.anagram-sys.co.uk/
http://www.web-planets.com/davec/techsitedb/
"Frank Tudor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Guys I need help!
>
> I think I am on the right track with my logic but my code fails.
> Can someone help? (my coding is weak no formal training).
>
> Thanks,
> Frank
>
>
> $TotalString = "$total";
> function Price($total)
> {
> if "$total" <= "24" then "$total" * "3200"
> else
> if "$total" >= "25" and "$total" <= "49" then "$total" *
> "3000"
> else
> if "$total" >= "50" and "$total" <= "99" then "$total" *
> "2900"
> else
> if "$total" >= "100" then "$total" * "2700"
> return "$Price";
> }
> echo "$Price";
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com