in reply to Referal Page

$variable = $ENV{HTTP_REFERER}; gets the page from which the cgi program called.