Image

Imagertimmons wrote in Imagephp

quick help

Hi! I'm somewhat of a newbie at PHP, but I have what I think is a pretty firm grasp at what I do know.

I'm designing a site for a lady who does embroidery. Personalization is $0.50 per english letter and $0.75 per hebrew letter with a minimum charge of $10. I have the following code running, but it's not doing its job. Any help would be GREATLY appreciated

Thanks so much.


where $personalization is user text
where $hebrew is 1/0 if hebrew is present
(no charge for spaces)

<?
[...]
if ( isset ( $personalization ) )
{
if ( $hebrew == "1" )
{
$lettercost = 0.75;
$data = "$personalization";
$result = count_chars($data, ' ');
$my_string = "$personalization";
$count = mb_strlen($my_string);
$acost = $count - $result;
if ( $acost <= 20 ) { $acost = 20; }
$cost += $lettercost * $acost;
}
elseif ( $hebrew == "2" )
{
$lettercost = 0.50;
$data = "$personalization";
$result = count_chars($data, ' ');
$my_string = "$personalization";
$count = mb_strlen($my_string);
$acost = $count - $result;
if ( $acost <= 20 ) { $acost = 20; }
$cost += $lettercost * $acost;
}
[...]
?>