Operating System - HP-UX
1834665 Members
2588 Online
110069 Solutions
New Discussion

Help!! Trying to carry values from one game to another

 
cindy_48
New Member

Help!! Trying to carry values from one game to another

I wrote a program that gets user input by placing a bet as to what the dice turns up using rand. User submits and finds out their point balance and they have the option of playing the game again. How to I keep track of the points?(Carry them over to second round) What is the best way hidden fields? Cookies? Any suggestions would be greatly appreciated.
Attached is the program i wrote.
1 REPLY 1
Steven E. Protter
Exalted Contributor

Re: Help!! Trying to carry values from one game to another

The answer is: It depends.

If you are going to be running this i a web based interface, a cookie is a good way to retain scoring information.

It its just one number, you can create a temporary file:

filename="dice$$.dat";

The filename is now dice.dat

You can save that file to the /tmp directory. I suppose if you were running this program on a popular gambling website you might have lots of temporary files, but this looks more like a class project.

Its also possible and easy to pass the fields through to a new form via http post methodology.

The script I'm attaching actually accepts data in hidden and non-hidden fields from a web based form.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com