Post your variables at first to PHP script, for example, and open the next script from this PHP page using invisible form to transfer all variables, for example, or just Javascript or whatever you want.
Or open PHP from cgi script, if it is possible.