Thanks that is what the problem was.
i had a $server['http_referer'] variable from and 'any form post' trigger resulting in this code.
if (($SERVER["REQUEST_METHOD"] == "POST") && (strpos($SERVER["HTTP_REFERER"], $SERVER["SERVER_NAME"].$SERVER["SCRIPT_NAME"])===0 || strpos($SERVER["HTTP_REFERER"], $SERVER["SERVER_NAME"].$SERVER["SCRIPT_NAME"])>0))
changed to submit button pressed trigger and it worked perfectly.
thanks very much for your help