Had to use random numbers to prevent caching of pages by mobile web browsers. It’s entirely possible that I made this workaround too complicated, as I had a file version problem on my local drive (I was updating the wrong file.)
The first page uses a random number in a hidden field with the POST method:
Magic 8-ball
The second page appends a random number to the URL:
$responses = array(
"As I see it, yes",
"It is certain",
"It is decidedly so",
"Most likely",
"Outlook good",
"Signs point to yes",
"Without a doubt",
"Yes",
"Yes - definitely",
"You may rely on it",
"Reply hazy, try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again",
"Don't count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful");
?>
Magic 8-ball
$selection = rand(0, count($responses)-1); ?>
The magic 8-ball says:
echo "[".$responses[$selection]."]"; echo "
";
echo "Ask another question";
?>
One response to “Two page mobile magic 8-ball”
Here’s a request. When I was in public accounting my clients would give me a hard time a joke about our fees. It was all in good fun. Now that I’m on the other side, I can really see where they are coming from. Every minute they are in our office working I can hear cha-ching and watch the dollars increasing. At one point I thought it would be humorous to put a taxi meter outside the conference room door where they were working. It would advance about 7 cents per second. Your magic eight ball gave me the idea to create a web page instead. Kind of like a countdown script, except it would count up and each second would be multiplied by a dollar amount based on an input variable. Then I could return the favor and poke some fun at my consultants.
Mike Campbell’s last blog post..Make It Easy For Your Customers To Do Business With You