Re: I'm a moron. So?

From: Date: Sun, 22 Apr 2001 20:02:02 +0000
Subject: Re: I'm a moron. So?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49758@lists.php.net to get a copy of this message
On Saturday 21 April 2001 04:42, ddogbruce@home.com wrote: > Alrighty. I'm baack! Anyways, I seem to be having stupid little > problems, al of which are driving me insane. I'll feel really > stupid when you tell me the problem. A friend told me something about > "seeding" for random() but I didn't find anything on that. try this and learn from it :) <? if (empty($name)) { ?> <HTML> <HEAD> <TITLE>Horse Race v.1</TITLE> </HEAD> <BODY> Welcome to horse racing v.1. This is a simple PHP game where you can train, race and win money for your animals. Eventually I'll make it a whole barn with feeding and horses, and costs, age, breeding. So on. But for now, this is just a simple game.<br><br> Enter six names of horses. <FORM ACTION="<?=$PHP_SELF?>" METHOD="post"> <? for ($i=1;$i<=6;$i++) { // I hate to repeat text ;) echo "Name$i : <INPUT TYPE=\"text\" NAME=\"name[]\" size=\"24\"><BR>\n"; ?> <input type="submit" name="submitNms" value="race them!"> </FORM> <CENTER>Good luck!</CENTER> </BODY> </HTML> <? } else { srand((double)microtime()*1000000); // prepare the random sequence. $randomHorse = round(rand(1,6)); // makes a random horse $randomStrides = rand(1, 10); // whatever strides are echo $name[$randomHorse] ." won the race by $randomStrides ! Congratulations."; // the var name is the array from the form.. } ?> -- php developer / CoreTrek AS | Remembering is for those who have Sandnes / Rogaland / Norway | forgotten. -- Chinese proverb web: http://www.moijk.net/ |

« previous php.general (#49758) next »