Page 1 of 1
Lottery Game
Posted: Tue Nov 01, 2011 4:41 pm
by jetlife76
Ok so i am trying to create a program similar to the "PowerBall" lottery game.
My front form is set up using 6 dropdown lists , Lists 1-5 have been given the numbers 1-59
the last List(Powerball) 1-39
I want to use these lists as arrays and get the user's picks from them then compare them with the results.
my question is with so many arrays how do i begin to code something like this.
I'm not asking for anyone to do it for me, just need a bit of help getting started on my Logic.
What i have so far:
Code: Select all
<?php
$Number1 = $_POST['num1'];
$Number2 = $_POST['num2'];
$Number3 = $_POST['num3'];
$Number4 = $_POST['num4'];
$Number5 = $_POST['num5'];
$PowerB = $_POST['Power'];
$pick= rand(1, 59);
$pick2= rand(1, 39);
if (isset($_POST['numbers'])){
if ($Number1 == $pick){
print "$Number1";
if($Number2 == $pick)
print "$Number2";
if ($Number3 == $pick)
print "$Number3";
if ($Number4 == $pick)
print "$Number4";
if ($Number5 == $pick)
print "$Number5";
if ($PowerB == $pick2)
print "$PowerB";
}
else {
print "*Five numbers and a PowerBall selection Required*";}}
?>
Re: Lottery Game
Posted: Tue Nov 01, 2011 5:50 pm
by manohoo
Maybe this can help you
Code: Select all
$numbers = array();
function draw() {
return rand(1,59);
}
for ($i=0; sizeof($numbers) < 6; $i++) {
$new = draw();
if (in_array($new, $numbers)) {
$new = draw ();
} else {
$numbers[] = $new;
}
}
var_dump($numbers);
Re: Lottery Game
Posted: Tue Nov 01, 2011 6:10 pm
by twinedev
Here are the issues with what you have so far:
1. There is nothing to make sure that the user didn't pick the same number more than once (for the first 5)
2. You are picking One random number and one Random powerball number (simulate the drawing??) if it is to simulate the drawing, you need to pick five unique values for their balls instead.
3. Only if their first number they chose matches your picked number, then do you print that number, and then check if all other numbers match the same number (and print them if they do) Proper indentation would have made this more noticeable...
Since I'm the type that can code faster than explain, I already coded how I would do it, and now will explain how I would do it:
1. Create an array to hold the numbers they pick.
2. Set a variable to hold their picked powerball, initialize it to 0
3. Loop through all the $_POST['numX'] items, if the number is between 1 and 59, and not already in the array of picked numbers, add it in.
4. Check $_POST['Power'] and if it is between 1 and 39, set the variable in step 2.
5. If the count() of the array to hold their numbers is NOT 5, or the variable in step 2 is still zero, error and tell them to pick correctly
5a. use sort() to sort their picks from lowest to highest for display purposes
6. Now that we know we have 5 unique values and a power ball, "Draw" the numbers:
6a. use range(1,59) to get an array containing 1 - 59
6b. use shuffle() to randomize the order of the above
6c. use array_chunk() to break it up to arrays of 5 balls each (except last element, but we only care about the first one)
6d. element 0 of the above will be 5 random numbers drawn
6e. user sort() to sort those 5 values from lowest to highest for display order
6e. as you already did, use rand(1,39) to pick the powerball.
7 To check the results (assuming you are displaying their numbers, and highlighting what DID match)
7a. foreach() their picked numbers, using $key=>$val so you have the key
7b. use in_array() to see if $val is in the array of picked numbers, if so highlight it as a match when display, otherwise just display
7c. Also in the above IF statement, if it does NOT match, use unset() to unset that particular array element using $key
7d. If PB picked and drawn match, display with hightlight, otherwise just display
8. Figure out how they actually did.
8a. Use count() on the array of picked numbers to see how many matched (all non matching would have been unset)
8a. Display how many matched and if PB matched (same check as in 7d)
9. Do what you want with the results...
So that is the gist of what I would do. In order to test out the above (and I was bored) I wrote this code as a sample page. Skip over my next post if you don't wanna see the working code....
-Greg
Re: Lottery Game
Posted: Tue Nov 01, 2011 6:14 pm
by twinedev
Again, this is the code I used to define and test the above.... Don't read if you don't want a direct "solution"
Code: Select all
<html>
<head>
<title>Sample PowerBall™ Emulator</title>
</head>
<body>
<h2>Sample PowerBall™ Emulator*</h2>
<?php
$intGrandPize = 10000000;
$intRegCount = 5;
$intMaxReg = 59;
$intMaxPB = 39;
if (count($_POST)>0) {
$aryPick = array();
$intPower = 0;
for($t=1;$t<=$intRegCount;$t++) {
if (isset($_POST['num'.$t])) {
$intPick = (int)$_POST['num'.$t];
if ($intPick > 0 && $intPick <= $intMaxReg && !in_array($intPick,$aryPick)) {
$aryPick[] = $intPick;
}
}
}
if (isset($_POST['Power']) && (int)$_POST['Power'] > 0 && $_POST['Power'] <= $intMaxPB) {
$intPower = (int)$_POST['Power'];
}
if (count($aryPick) < 5 || $intPower == 0) {
echo '*Five unique numbers and a PowerBall™ selection are Required*';
}
else {
// Have valid numbers...
sort($aryPick); // For if you are going to display them, they will be in order...
// Pick your winners
$aryAllBalls = range(1,$intMaxReg); // array of numbers 1 - 59
shuffle($aryAllBalls); // Randomize their order
$aryAllBalls = array_chunk($aryAllBalls,$intRegCount);
// The above breaks up into an array with 5 numbers each
// [0] contains the first 5 balls of all balls randomized, these are what are "picked"
$aryPickedBalls = $aryAllBalls[0];
sort($aryPickedBalls); // Sort them for display
$intPowerBall = rand(1,$intMaxPB);
echo "YOUR WINNING NUMBERS ARE: <br>",implode(' ',$aryPickedBalls),' PB: ',$intPowerBall,"<br>\n<br>\n";
echo "You Picked: ";
foreach($aryPick as $key=>$val) {
if (in_array($val,$aryPickedBalls)) {
echo '<strong>',$val,'</strong> ';
}
else {
echo $val,' ';
unset($aryPick[$key]); // Remove it since it didn't match
}
}
$bMatchPB = ($intPower == $intPowerBall); // Set here since checked in 3 places...
if ($bMatchPB) {
echo 'PB: <strong>',$intPower,"</strong><br>\n<br>\n";
}
else {
echo 'PB: '.$intPower,"<br>\n<br>\n";
}
// At this point, $aryPick will only contain matching numbers...
$intMatches = count($aryPick);
echo 'You matched '.$intMatches,' numbers and did ';
if (!$bMatchPB) { echo 'not '; }
echo "match the PowerBall™ number.<br><br>\n\n";
// HERE YOU WOULD DO SOMETHING TO SAY HOW MUCH THEY WON
// Using rules here: http://www.powerball.com/powerball/pb_prizes.asp
if ($intMatches>=3 || $bMatchPB) {
$intWinnings = 0;
switch ($intMatches) {
case 0:
if ($bMatchPB) { $intWinnings = 3; }
break;
case 1:
if ($bMatchPB) { $intWinnings = 4; }
break;
case 2:
if ($bMatchPB) { $intWinnings = 7; }
break;
case 3:
if ($bMatchPB) {
$intWinnings = 100;
} else {
$intWinnings = 7;
}
break;
case 4:
if ($bMatchPB) {
$intWinnings = 10000;
} else {
$intWinnings = 100;
}
break;
case 5:
if ($bMatchPB) {
$intWinnings = $intGrandPize;
} else {
$intWinnings = 200000;
}
break;
default:
echo "ERROR: Winning Combination not defined in systen!!!<br>\n";
}
echo "<strong>YOU ARE A WINNER!!!!</strong><br>\n";
echo 'You Won: $'.number_format($intWinnings,0),"<br>\n";
}
else {
echo "Sorry, you didn't win. Try again!<br>\n";
}
} // END: if (had valid numbers picked)
} // END: There was data posted (ie. Form submitted)
?>
<hr>
<p>Pick your numbers!!</p>
<form action="" method="post">
<?php for($t=1;$t<=$intRegCount;$t++): ?>
<select name="num<?php echo $t; ?>">
<option value="0">Pick</option>
<?php for($n=1;$n<=$intMaxReg;$n++): ?>
<?php if (isset($_POST['num'.$t]) && $_POST['num'.$t]==$n): ?>
<option selected="selected" value="<?php echo $n; ?>"><?php echo $n; ?></option>
<?php else: ?>
<option value="<?php echo $n; ?>"><?php echo $n; ?></option>
<?php endif; ?>
<?php endfor; ?>
</select>
<?php endfor; ?>
PB
<select name="Power">
<option value="0">Pick</option>
<?php for($n=1;$n<=$intMaxPB;$n++): ?>
<?php if (isset($_POST['Power']) && $_POST['Power']==$n): ?>
<option selected="selected" value="<?php echo $n; ?>"><?php echo $n; ?></option>
<?php else: ?>
<option value="<?php echo $n; ?>"><?php echo $n; ?></option>
<?php endif; ?>
<?php endfor; ?>
</select>
<br>
<input type="submit" name="submit" value="PLAY THESE NUMBERS!">
</form>
<hr>
<em><strong>*</strong> This is for programming demonstration only. This is not associated with the actual PowerBall™ Lottery or used for any type of gambling. YOU CANNOT ACTUALLY WIN MONEY ON THIS PAGE.</em>
</body>
</html>
PS. With how many times I had to submit the form to test results... really made me not want to go waste money actually playing the real game..... But hey, it is currently at what, over 100 million, I'll donate $1 to who ever wins and hope it is me LOL
Re: Lottery Game
Posted: Tue Nov 01, 2011 7:43 pm
by jetlife76
lol thanks, that's why i dont gamble!!! I'll look over your code and see wut i come up with ! Thanks once again
Re: Lottery Game
Posted: Tue Nov 08, 2011 2:02 am
by jetlife76
Hey Greg if you are there i need help with adding a quick pick option to this program, my question is would i just create a variable (variable = rand1, 59)) numbers 1-5 & PB and add another if statement?
Re: Lottery Game
Posted: Tue Nov 08, 2011 3:38 am
by twinedev
Quick pick as in that it will auto pick the numbers for the person? If so then this chunk of code, which picked random "winning" numbers, can be used to auto pick the numbers for the person:
Code: Select all
$aryAllBalls = range(1,$intMaxReg); // array of numbers 1 - 59
shuffle($aryAllBalls); // Randomize their order
$aryAllBalls = array_chunk($aryAllBalls,$intRegCount);
// The above breaks up into an array with 5 numbers each
// [0] contains the first 5 balls of all balls randomized, these are what are "picked"
$aryPickedBalls = $aryAllBalls[0];
sort($aryPickedBalls); // Sort them for display
$intPowerBall = rand(1,$intMaxPB);
Re: Lottery Game
Posted: Tue Nov 08, 2011 4:39 am
by mikeashfield
twinedev wrote:Quick pick as in that it will auto pick the numbers for the person? If so then this chunk of code, which picked random "winning" numbers, can be used to auto pick the numbers for the person:
Code: Select all
$aryAllBalls = range(1,$intMaxReg); // array of numbers 1 - 59
shuffle($aryAllBalls); // Randomize their order
$aryAllBalls = array_chunk($aryAllBalls,$intRegCount);
// The above breaks up into an array with 5 numbers each
// [0] contains the first 5 balls of all balls randomized, these are what are "picked"
$aryPickedBalls = $aryAllBalls[0];
sort($aryPickedBalls); // Sort them for display
$intPowerBall = rand(1,$intMaxPB);
I'm not questioning your code, as you clearly know what you're talking about; but could you explain where and how "// The above breaks up into an array with 5 numbers each", I don't see the number 5 there anywhere. :-S
Re: Lottery Game
Posted: Tue Nov 08, 2011 10:27 am
by jetlife76
Ok so since i already have that code in my form, i am using again for quick pick?
i have a button on the input but thinking about making it a checkbox instead because i dont know how to get the picks to post from a button
Re: Lottery Game
Posted: Tue Nov 08, 2011 11:40 am
by jetlife76
Duh nevermind that last statement about the button, wasnt thinking clearly
Re: Lottery Game
Posted: Sat Nov 26, 2011 11:46 am
by jetlife76
Ok i know it's been a while since i last posted here but this quickpick option still has me. I've tried using the code you've given me, i used the random generator from the original code to but i can't get it to work. Some of my results: I've gotten the button to print out numbers but they seem to be the same numbers that are picked manually; Ive had it where it would validate that the button has been selected but it seems to be working with the manual numbers. If you could at least tell me where the If statement would go in the code it would be a huge help, Thanks again
Re: Lottery Game
Posted: Sat Nov 26, 2011 9:19 pm
by jetlife76
Ok i got it all to work, but i noticed that when i click the quick pick button, it doesnt check to see if any the numbers match the winning numbers, i think it has something to do with my foreach statement for the quick pick option.
Here's whatr i have so far:
Code: Select all
<?php
$intGrandPize = 10000000;
$intRegCount = 5;
$intMaxReg = 59;
$intMaxPB = 49;
$aryPick = array();
$intPower = 0;
$intPowerBall = rand(1,$intMaxPB);
if (isset($_POST['quickP'])){
//$intPowerBall = rand(1,$intMaxPB);
$aryAllBalls = range(1,$intMaxReg); // array of numbers 1 - 59
shuffle($aryAllBalls); // Randomize their order
$aryAllBalls = array_chunk($aryAllBalls,$intRegCount); // The above breaks up into an array with 5 numbers each
// [0] contains the first 5 balls of all balls randomized, these are what are "picked"
$aryPickedBalls = $aryAllBalls[0];
sort($aryPickedBalls); // Sort them for display
$intPowerBall2 = rand(1,$intMaxPB);
$aryAllBalls2 = range(1,$intMaxReg); // array of numbers 1 - 59
shuffle($aryAllBalls2); // Randomize their order
$aryAllBalls2 = array_chunk($aryAllBalls2,$intRegCount); // The above breaks up into an array with 5 numbers each
// [0] contains the first 5 balls of all balls randomized, these are what are "picked"
$aryPickedBalls2 = $aryAllBalls2[0];
sort($aryPickedBalls2); // Sort them for display
echo "YOUR WINNING NUMBERS ARE: <br>",implode(' ',$aryPickedBalls),' PB: ',$intPowerBall,"<br>\n<br>\n";
echo "You picked: <br>",implode(' ',$aryPickedBalls2),' PB: ',$intPowerBall2,"<br>\n<br>\n";
foreach($aryPick as $key=>$val) {
if (in_array($val,$aryPickedBalls2)) {
echo '<strong>',$val,'</strong> ';
}
else {
echo $val,' ';
unset($aryPick[$key]); // Remove it since it didn't match
}
}
$bMatchPB = ($intPower == $intPowerBall2); // Set here since checked in 3 places...
if ($bMatchPB) {
echo 'PB: <strong>',$intPower,"</strong><br>\n<br>\n";
}
else {
// At this point, $aryPick will only contain matching numbers...
$intMatches = count($aryPick);
echo 'You matched '.$intMatches,' numbers and did ';
if (!$bMatchPB) { echo 'not '; }
echo "match the PowerBall number.<br><br>\n\n";
}
if ($intMatches>=3 || $bMatchPB) {
$intWinnings = 0;
switch ($intMatches) {
case 0:
if ($bMatchPB) { $intWinnings = 3; }
break;
case 1:
if ($bMatchPB) { $intWinnings = 4; }
break;
case 2:
if ($bMatchPB) { $intWinnings = 7; }
break;
case 3:
if ($bMatchPB) {
$intWinnings = 100;
} else {
$intWinnings = 7;
}
break;
case 4:
if ($bMatchPB) {
$intWinnings = 10000;
} else {
$intWinnings = 100;
}
break;
case 5:
if ($bMatchPB) {
$intWinnings = $intGrandPize;
} else {
$intWinnings = 200000;
}
break;
default:
echo "ERROR: Winning Combination not defined in systen!!!<br>\n";
}
echo "<strong>YOU ARE A WINNER!!!!</strong><br>\n";
echo 'You Won: $'.number_format($intWinnings,0),"<br>\n";
}
}
//$quick_pick = array_slice($numberRange, 0, 6);}
//$numberRange = range(1, $intMaxReg);
//shuffle($numberRange);
elseif (count($_POST)>0) {
$aryPick = array();
$intPower = 0;
for($t=1;$t<=$intRegCount;$t++) {
if (isset($_POST['num'.$t])) {
$intPick = (int)$_POST['num'.$t];
if ($intPick > 0 && $intPick <= $intMaxReg && !in_array($intPick,$aryPick)) {
$aryPick[] = $intPick;
}
}
}
if (isset($_POST['Power']) && (int)$_POST['Power'] > 0 && $_POST['Power'] <= $intMaxPB) {
$intPower = (int)$_POST['Power'];
}
if (count($aryPick) < 5 || $intPower == 0) {
echo "<font color='red'>'*Five unique numbers and a PowerBall selection are Required*'</font>";;
}
else {
// Have valid numbers...
sort($aryPick); // For if you are going to display them, they will be in order...
// Pick your winners
$aryAllBalls = range(1,$intMaxReg); // array of numbers 1 - 59
shuffle($aryAllBalls); // Randomize their order
$aryAllBalls = array_chunk($aryAllBalls,$intRegCount);
// The above breaks up into an array with 5 numbers each
// [0] contains the first 5 balls of all balls randomized, these are what are "picked"
$aryPickedBalls = $aryAllBalls[0];
sort($aryPickedBalls); // Sort them for display
echo "YOUR WINNING NUMBERS ARE: <br>",implode(' ',$aryPickedBalls),' PB: ',$intPowerBall,"<br>\n<br>\n";
echo "You Picked: ";
foreach($aryPick as $key=>$val) {
if (in_array($val,$aryPickedBalls)) {
echo '<strong>',$val,'</strong> ';
}
else {
echo $val,' ';
unset($aryPick[$key]); // Remove it since it didn't match
}
}
$bMatchPB = ($intPower == $intPowerBall); // Set here since checked in 3 places...
if ($bMatchPB) {
echo 'PB: <strong>',$intPower,"</strong><br>\n<br>\n";
}
else {
echo 'PB: '.$intPower,"<br>\n<br>\n";
}
// At this point, $aryPick will only contain matching numbers...
$intMatches = count($aryPick);
echo 'You matched '.$intMatches,' numbers and did ';
if (!$bMatchPB) { echo 'not '; }
echo "match the PowerBall number.<br><br>\n\n";}}
// HERE YOU WOULD DO SOMETHING TO SAY HOW MUCH THEY WON
$intMatches = count($aryPick);
$bMatchPB = ($intPower == $intPowerBall);
if ($intMatches>=3 || $bMatchPB) {
$intWinnings = 0;
switch ($intMatches) {
case 0:
if ($bMatchPB) { $intWinnings = 3; }
break;
case 1:
if ($bMatchPB) { $intWinnings = 4; }
break;
case 2:
if ($bMatchPB) { $intWinnings = 7; }
break;
case 3:
if ($bMatchPB) {
$intWinnings = 100;
} else {
$intWinnings = 7;
}
break;
case 4:
if ($bMatchPB) {
$intWinnings = 10000;
} else {
$intWinnings = 100;
}
break;
case 5:
if ($bMatchPB) {
$intWinnings = $intGrandPize;
} else {
$intWinnings = 200000;
}
break;
default:
echo "ERROR: Winning Combination not defined in systen!!!<br>\n";
}
echo "<strong>YOU ARE A WINNER!!!!</strong><br>\n";
echo 'You Won: $'.number_format($intWinnings,0),"<br>\n";
}
?>
Re: Lottery Game
Posted: Fri Dec 09, 2011 12:50 pm
by jetlife76
I have a question about the original version of this program. i want to create another set of dropdown lists to test if all the results are posted correctly. (ie.)
If all numbers match, the jackpot is Posted
If 3 numbers and the powerball match.....
Instead of trying over and over to see if the results are correct.
Any clue of how to do this?
Any help on this would greatly appreciated
Re: Lottery Game
Posted: Fri Dec 09, 2011 4:38 pm
by jetlife76
This is the code i am referring to:
Code: Select all
<html>
<head>
<title>Sample PowerBall™ Emulator</title>
</head>
<body>
<h2>Sample PowerBall™ Emulator*</h2>
<?php
$intGrandPize = 10000000;
$intRegCount = 5;
$intMaxReg = 59;
$intMaxPB = 39;
if (count($_POST)>0) {
$aryPick = array();
$intPower = 0;
for($t=1;$t<=$intRegCount;$t++) {
if (isset($_POST['num'.$t])) {
$intPick = (int)$_POST['num'.$t];
if ($intPick > 0 && $intPick <= $intMaxReg && !in_array($intPick,$aryPick)) {
$aryPick[] = $intPick;
}
}
}
if (isset($_POST['Power']) && (int)$_POST['Power'] > 0 && $_POST['Power'] <= $intMaxPB) {
$intPower = (int)$_POST['Power'];
}
if (count($aryPick) < 5 || $intPower == 0) {
echo '*Five unique numbers and a PowerBall™ selection are Required*';
}
else {
// Have valid numbers...
sort($aryPick); // For if you are going to display them, they will be in order...
// Pick your winners
$aryAllBalls = range(1,$intMaxReg); // array of numbers 1 - 59
shuffle($aryAllBalls); // Randomize their order
$aryAllBalls = array_chunk($aryAllBalls,$intRegCount);
// The above breaks up into an array with 5 numbers each
// [0] contains the first 5 balls of all balls randomized, these are what are "picked"
$aryPickedBalls = $aryAllBalls[0];
sort($aryPickedBalls); // Sort them for display
$intPowerBall = rand(1,$intMaxPB);
echo "YOUR WINNING NUMBERS ARE: <br>",implode(' ',$aryPickedBalls),' PB: ',$intPowerBall,"<br>\n<br>\n";
echo "You Picked: ";
foreach($aryPick as $key=>$val) {
if (in_array($val,$aryPickedBalls)) {
echo '<strong>',$val,'</strong> ';
}
else {
echo $val,' ';
unset($aryPick[$key]); // Remove it since it didn't match
}
}
$bMatchPB = ($intPower == $intPowerBall); // Set here since checked in 3 places...
if ($bMatchPB) {
echo 'PB: <strong>',$intPower,"</strong><br>\n<br>\n";
}
else {
echo 'PB: '.$intPower,"<br>\n<br>\n";
}
// At this point, $aryPick will only contain matching numbers...
$intMatches = count($aryPick);
echo 'You matched '.$intMatches,' numbers and did ';
if (!$bMatchPB) { echo 'not '; }
echo "match the PowerBall™ number.<br><br>\n\n";
// HERE YOU WOULD DO SOMETHING TO SAY HOW MUCH THEY WON
// Using rules here: http://www.powerball.com/powerball/pb_prizes.asp
if ($intMatches>=3 || $bMatchPB) {
$intWinnings = 0;
switch ($intMatches) {
case 0:
if ($bMatchPB) { $intWinnings = 3; }
break;
case 1:
if ($bMatchPB) { $intWinnings = 4; }
break;
case 2:
if ($bMatchPB) { $intWinnings = 7; }
break;
case 3:
if ($bMatchPB) {
$intWinnings = 100;
} else {
$intWinnings = 7;
}
break;
case 4:
if ($bMatchPB) {
$intWinnings = 10000;
} else {
$intWinnings = 100;
}
break;
case 5:
if ($bMatchPB) {
$intWinnings = $intGrandPize;
} else {
$intWinnings = 200000;
}
break;
default:
echo "ERROR: Winning Combination not defined in systen!!!<br>\n";
}
echo "<strong>YOU ARE A WINNER!!!!</strong><br>\n";
echo 'You Won: $'.number_format($intWinnings,0),"<br>\n";
}
else {
echo "Sorry, you didn't win. Try again!<br>\n";
}
} // END: if (had valid numbers picked)
} // END: There was data posted (ie. Form submitted)
?>
<hr>
<p>Pick your numbers!!</p>
<form action="" method="post">
<?php for($t=1;$t<=$intRegCount;$t++): ?>
<select name="num<?php echo $t; ?>">
<option value="0">Pick</option>
<?php for($n=1;$n<=$intMaxReg;$n++): ?>
<?php if (isset($_POST['num'.$t]) && $_POST['num'.$t]==$n): ?>
<option selected="selected" value="<?php echo $n; ?>"><?php echo $n; ?></option>
<?php else: ?>
<option value="<?php echo $n; ?>"><?php echo $n; ?></option>
<?php endif; ?>
<?php endfor; ?>
</select>
<?php endfor; ?>
PB
<select name="Power">
<option value="0">Pick</option>
<?php for($n=1;$n<=$intMaxPB;$n++): ?>
<?php if (isset($_POST['Power']) && $_POST['Power']==$n): ?>
<option selected="selected" value="<?php echo $n; ?>"><?php echo $n; ?></option>
<?php else: ?>
<option value="<?php echo $n; ?>"><?php echo $n; ?></option>
<?php endif; ?>
<?php endfor; ?>
</select>
<br>
<input type="submit" name="submit" value="PLAY THESE NUMBERS!">
</form>
<hr>
<em><strong>*</strong> This is for programming demonstration only. This is not associated with the actual PowerBall™ Lottery or used for any type of gambling. YOU CANNOT ACTUALLY WIN MONEY ON THIS PAGE.</em>
</body>
</html>