# [PHP] calculation based on checkbox

<?php
through an HTML form
# splits the ad into an array called \$words

# counts the number of expressions in the array
\$num = count(\$words);

# variable used to check how many of the expressions are really spaces
\$count2 = 0;

for(\$i = 0; \$i < \$num; \$i++){ # determines if any variables are empty and if
they are \$count goes up one to determine how many spaces there are in the
expressions
if (\$words[\$count2] == "" ){
\$count = \$count + 1;
}
\$count2 = \$count2 + 1;
}

\$num = \$num - \$count; #gets the new number of words

\$price = 5.00;

if (\$num > 10) { # if the users ad has more than 10 words in it than
\$quarters = the extra words times .20
\$subtractor = \$num - 10;
\$quarters = \$subtractor * .20;
}
\$subtotal = \$price + \$quarters; # price plus the number of words over 10
\$total = \$papers * \$subtotal; # new price multiplied by number of papers
\$total = \$total * \$weeks; # new new price multiplied by number of weeks
\$total = sprintf ("%01.2f", \$total);
?>
Here is part of my function thus far, and the output is a simple \$\$ based on
the number of words, I just need to add an IF statement to determine whether
or not I will need to subtract a certain amount if a checkbox is checked. I
am assuming that the IF statement would be something like...
IF \$variable = 1; {
\$variable - \$total = \$total2
)
Else do the rest of the code...
I am still a newbie to php so any help would be great.