This topic is locked

Trying to get this working

10/2/2008 1:53:47 AM
PHPRunner General questions
S
swanside author

I have tried this code

if ($values["Vatable"])

$values["VAT"] = $values["Amount/47*7"];

return true;


I am trying to display the Vatable amount only if the Vatable checkbox is ticked, I can not get it to do the maths, I think my problem is around this part "$values["Amount/47*7"];"
The Field Amount is what gets entered as a total on the Add page, if the checkbox is ticked then I need the results to go into the VAT box?
Any ideas please??
Cheers

Paul

M
mattd1 10/2/2008

This might be a bit naive but I recall having a similar pain recently.
I think it was because my checkbox was a TINYINT field and not a boolean, so I had to check was it if checkboxfield==0 or <>0 rather than treating it as a boolean.
And I reckon this part: $values["VAT"] = $values["Amount/477"];
probably needs to be more like this so you're referring to the field by its correct name $values["Amount"]:
$values["VAT"] = ($values["Amount"]/47)
7;


Hope that helps, and apologies if not.
Matt

S
swanside author 10/2/2008

Thanks, Will give that a go.
Paul.