Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

help Simple lottery php script

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

help Simple lottery php script

Postby machachar » Sat May 11, 2013 1:50 am

Dear All,

I wrote simple script of "lottery" it echo message ("Try again bad luck" ) not single time ("You won Lottery" ) even i wrote several times random nos in input box. Please help me to correct it. code is given below





<html>
<title> Lottery </title>

<form action="http://localhost/mumtaz/lotterygame.php" method="post">
Enter your lucky number: <input type = "text" name="num"> <br/>
<input type ="submit" value= "Submit">
</form>
</html>

<?php

$n=$_POST['num'];



$r=rand(10,100);



if ($n==$r){

echo ("You won Lottery" );
}
else {
echo ("Try again bad luck" );

}


Regards,

Mumtaz
machachar
New php-forum User
New php-forum User
 
Posts: 5
Joined: Tue Dec 06, 2011 2:58 pm

Return to PHP coding => General

Who is online

Users browsing this forum: adershvc and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.