Home | Scripts | Tutorials | Books | Hosting | Forums | Links|

Navigation:

Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Blog
Books
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links






 
 

SPONSORS



 
 

Random Amazon book link

This is similar to our previous example using Amazon book images but this time we wil use simply plain text links.

Here is the code.

<?php
//the URL of each book
$urlama = array("http://www.amazon.com/exec/obidos/ASIN/1861002963/basicvisualbasic",
"http://www.amazon.com/exec/obidos/ASIN/1565927699/basicvisualbasic",
"http://www.amazon.com/exec/obidos/ASIN/076152729X/basicvisualbasic",
"http://www.amazon.com/exec/obidos/ASIN/0672318040/basicvisualbasic");
//description of each book
$descama = array("Professional Php Programming (Programmer...",
"PHP Pocket Reference",
"Php Essentials",
"Teach Yourself PHP4 in 24 Hours...");
//generate a random number
srand((double)microtime() * 1000000);
$randno = (rand()%4);
//display random URL
echo ("<a href = $urlama[$randno]>$descama[$randno]</a>");
?>

And here is the example , refresh browser to see it in action

Teach Yourself PHP4 in 24 Hours...