forzatio Posted May 30, 2007 Share Posted May 30, 2007 Hi there, I got the info to use php random, but I can't get it to load a random frame. <?php //Chooses a random number $num = Rand (1,2); //Based on the random number, gives a quote switch ($num) { case 1: <frameset rows="100%,*" border="0"> <frame src="http://www.example.com" frameborder="0" /> <frame frameborder="0" noresize /> </frameset>; break; case 2: <frameset rows="100%,*" border="0"> <frame src="http://www.test.com" frameborder="0" /> <frame frameborder="0" noresize /> </frameset>; break; } ?> Link to comment https://forums.phpfreaks.com/topic/53609-loading-a-random-page-in-a-frame/ Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 <?php //Chooses a random number $num = Rand (1,2); //Based on the random number, gives a quote switch ($num) { case 1: ?><frameset rows="100%,*" border="0"> <frame src="http://www.example.com" frameborder="0" /> <frame frameborder="0" noresize /> </frameset> <?php break; case 2: ?> <frameset rows="100%,*" border="0"> <frame src="http://www.test.com" frameborder="0" /> <frame frameborder="0" noresize /> </frameset> <?php break; } ?> Link to comment https://forums.phpfreaks.com/topic/53609-loading-a-random-page-in-a-frame/#findComment-264976 Share on other sites More sharing options...
forzatio Posted May 30, 2007 Author Share Posted May 30, 2007 <?php //Chooses a random number $num = Rand (1,2); //Based on the random number, gives a quote switch ($num) { case 1: ?><frameset rows="100%,*" border="0"> <frame src="http://www.example.com" frameborder="0" /> <frame frameborder="0" noresize /> </frameset> <?php break; case 2: ?> <frameset rows="100%,*" border="0"> <frame src="http://www.test.com" frameborder="0" /> <frame frameborder="0" noresize /> </frameset> <?php break; } ?> that works , btw is this code fast to handle for the server or could it be way faster with some other code ? Link to comment https://forums.phpfreaks.com/topic/53609-loading-a-random-page-in-a-frame/#findComment-265022 Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 <?php $num = rand(1,2); echo "<frameset rows=\"100%,*\" border=\"0\">\n <frame src=\""; switch ($num) { case 1: echo "http://www.example.com"; break; case 2: echo "http://www.test.com"; break; } echo "\" frameborder=\"0\" />\n <frame frameborder=\"0\" noresize />\n</frameset>"; ?> That may be quicker. Link to comment https://forums.phpfreaks.com/topic/53609-loading-a-random-page-in-a-frame/#findComment-265026 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.