mysql - Having problems with a Gambling Application on my website (PHP) -
i'm trying make section of website support gambling (with game money, not irl)
goal: create simple buy ticket, wait tickets gone, randomly select winner. end user can buy amount of tickets left total of 8 available tickets , script choose winner out of number of applicants bought ticket.
current issue: main issue having problems php storing , retrieving data.
<form action="games.php" method"post" name="add_tickets"> <ul> <li> <input type="radio" name="ticket" value="one"><br> <input type="radio" name="ticket" value="two"><br> <input type="radio" name="ticket" value="three"><br> <input type="radio" name="ticket" value="four"><br> <input type="submit" value="submit"> </li> </ul> </form>
so i'm using radio buttons this. when button selected , submitted, post data on games.php.
then on games.php i'll have script job , when finished redirect user index.php form , have user's name ($username) beside radio button selected.
here games.php code: note: isn't code... snippet on main issue is
if(isset($_post['add_tickets'])){ $ticket = $_post['one']; $ticket = $_post['two']; $ticket = $_post['three']; $ticket = $_post['four']; } $ticket_owners[] = "$ticket"; print_r($ticket_owners);
i'm trying input ticket bought , username array i'll run rand(array) select winner , return answer.
hmm, did explain okay? not... wish knew little bit more php... sigh
can shed light on this... wrong direction take? can done better different methods?
your code should have been
$ticket = $_post['ticket']; // contain "one", "two", "three", or "four"
remove
if(isset($_post['add_tickets'])){ }
and remove
$ticket_owners[] = "$ticket";
now storing username in list later use select random winner from... need of database or cache. array example cease exist once page rendered , served user.
Comments
Post a Comment