P2P | IT Discussions Forum

Full Version: script help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have used the following php script to get random text in my website...

HTML Code:

<?php $number=mt_rand(1, 6); if ($number=="1") { include "navrandom1.php"; } if ($number=="2") { include "navrandom2.php"; } if ($number=="3") { include "navrandom3.php"; } if ($number=="4") { include "navrandom4.php"; } if ($number=="5") { include "navrandom5.php"; } if ($number=="6") { include "navrandom6.php"; } ?>



... each .php page is simply a paragraph and it works just fine, however, I was hoping to add about 20 different items as oppose to the current 6. Is there a shortcut in doing this or do I have to put...

HTML Code:

[HTML]<?php if ($number=="?") { include "navrandom?.php"; }



for each single item. Also, is there a way to put all the paragraphs in one page and have the script randomly choose one paragraph to display?
Reference URL's