OK, found a (temp) solution.

Use an undefined variable (ie a $xxxx that hasnt been used before) and it will write NULL into the database.

There must be some way to control this so that a variable can be used to enter the null.

Paul