Solved

php script for rand between 2 images

Posted on 2006-11-09
4
324 Views
Last Modified: 2010-04-16
i need an php script that "rands" between 2 images
main ideea ... i have 1.jpg and 2.jpg .. and at every refresh i want them changed
0
Comment
Question by:rares_dumitrescu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 19

Accepted Solution

by:
VoteyDisciple earned 250 total points
ID: 17906742

<img src="<?= rand(1, 2) ?>.jpg" alt="A Random Image" />
0
 

Assisted Solution

by:Eduardo_Pinto
Eduardo_Pinto earned 250 total points
ID: 17908061
<?php
session_start();

if ( isset($_SESSION[rand]) ){
 if ( $_SESSION[rand] == 1 ){
  $_SESSION[rand] = 2;
 }
 else{
  $_SESSION[rand] = 1;
 }
}
else{
   $_SESSION[rand] = 1;
}
?>

<img src="<?= $_SESSION[rand] ?>.jpg" />
 
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Introduction to Processes

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question