Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 06-26-2005, 01:59 PM Random Value
Junior Talker

Posts: 4
Trades: 0
I am having a bit of a problem, I have a search box on my php site which has an intial value set like so:

<input name="skey" type="text" value= "Magician" size="20" maxlength="64" onFocus="clearText(this)">

So this would search for magicians (obviously).

But I want to have the initial random 'value' so every time a user comes on the site they have a random seach they could perform, clown, singer etc.. for example
I have tried using php and a bit of java but nothing seems to work? Anybody know which direction I should be going to get this working?
chris_davidsonu is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-27-2005, 07:31 AM
Monkeon's Avatar
Skilled Talker

Posts: 59
Trades: 0
You probably want something like this

PHP Code:
<?php

$quotes
[] = "Magician";
$quotes[] = "Singer";
$quotes[] = "quote 3";
$quotes[] = "quote 4";
$quotes[] = "quote 5";
$quotes[] = "quote 6";

srand ((double) microtime() * 1000000);
$randomquote rand(0,count($quotes)-1);

echo 
"<input name=\"skey\" type=\"text\" value=\"$quotes[$randomquote]\" size=\"20\" maxlength=\"64\" onFocus=\"clearText(this)\">";

?>
Borrowed the code off of a website
__________________

Please login or register to view this content. Registration is FREE
FREE Online Dating!
Meet your perfect match online right now!
Monkeon is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Random Value
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09475 seconds with 12 queries