Popular Posts

Tuesday, 19 August 2014

Random images with php

Did you visited a website and on reload the blog image changed ?
Well in php that is easy.



<html>
<head>
<title>The Coder Tips | Random Images with php</title>
</head>
<body>
<?php

$rand = rand(1, 5);
if($rand == 1){
echo '<img src="1.jpg">';
}
if($rand == 2){
echo '<img src="2.jpg">';
}
if($rand == 3){
echo '<img src="3.jpg">';
}
if($rand == 4){
echo '<img src="4.jpg">';
}
if($rand == 5){
echo '<img src="5.jpg">';
}

?>
</body>
</html>


....................:)

No comments:

Post a Comment

Magento: How to get last order id

There are many ways to get last order id:   1. From checkout session: $lastOrderId = Mage::getSingleton('checkout/session'...