Having problems with a Gambling Application on my website (PHP)

d3kks

New Member
I'm trying to make a section of my website to support gambling (with game money, not irl)Goal: Create a simple Buy Ticket, Wait for tickets to be all gone, randomly select winner. So the end user can buy any amount of tickets left up to the total of 8 available tickets and then the script will choose a winner out of the number of applicants that bought a ticket.Current Issue: My main issue is having problems with PHP storing and retrieving data.\[code\]<form action="games.php" method"post" name="add_tickets"><ul><li><input type="radio" name="ticket" value="http://stackoverflow.com/questions/15895085/one"><br><input type="radio" name="ticket" value="http://stackoverflow.com/questions/15895085/two"><br><input type="radio" name="ticket" value="http://stackoverflow.com/questions/15895085/three"><br><input type="radio" name="ticket" value="http://stackoverflow.com/questions/15895085/four"><br><input type="submit" value="http://stackoverflow.com/questions/15895085/submit"></li></ul></form>\[/code\]So I'm using Radio buttons for this. When a button is selected and submitted, it will post the data over to games.php.Then on games.php I'll have my script do its job and when its finished it will redirect the user back to index.php where the form was and have the user's name ($username) beside the radio button he selected.Here is games.php code: NOTE: this isn't all the code... just a snippet on where my main issue is\[code\]if(isset($_POST['add_tickets'])){$ticket = $_POST['one'];$ticket = $_POST['two'];$ticket = $_POST['three'];$ticket = $_POST['four'];}$ticket_owners[] = "$ticket";print_r($ticket_owners);\[/code\]I'm trying to input which ticket they bought and their username into an array which then i'll run rand(array) to select a winner and return the answer.Hmm, did I explain this okay? probably not... I wish I knew a little bit more about PHP... sighCan anyone shed some light on this... is this the wrong direction to take? Can it be done better with different methods?
 
Top