= count($landingpage)) { $lpNumber = 1; } else { $lpNumber = $lpNumber + 1; } //write to the txt file. $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = $lpNumber . "\n"; fwrite($fh, $stringData); fclose($fh); //include the landing page include_once($landingpage[$lpNumber]); //terminate script die(); ?>