You are here: Need advice on which way is the best to pass variables « All PHP « IT news, forums, messages
Need advice on which way is the best to pass variables

Posted by Gladen Blackshield on 03/20/07 23:37

Hello All!

Still very new to PHP and I was wondering about the easiest and simplest way
to go about doing something for a project I am working on. I would simply
like advice on what I'm asking so I can go and learn it myself through doing
(best way for me).

I am building a card game as a learning-project as it involves many (to most
of the) things that I would like to learn to do with PHP.

This project is intended to be Flat-File only, no SQL connections. I'd much
rather not use cookies for this if at all possible.

The project involves loading different pictures on the top of the page while
the game is being played. That's easy enough to do, but it forces a refresh
when the picture changes.

which brings me to needing to find the porper solution to the following:

I am needing to keep roughly 12 or so variables tracked during the game.
This should be automatically parsed when the user clicks on 'DEAL' or
whatever to go to the next turn (going to the next turn would result in a
different picture being shown and thus force a refresh of the page)

I am not asking particularly HOW to pass the variables, as I have 3 options
that should work, I am simply asking which of these ideas seems to be the
most correct way to accomplish this task.

Method 1: pass the PHP variable through the form from the VALUE.....such as
echo "<input...................VALUE='<?php>$MyVariable</?>";

Method 2: write the variables to a text file (or some other file) and read
the file at the beginning of the turn and then write to the file at the end
of the turn, using the FILE commands.

Method 3: Start a session at the onset of the game and declare the
variables at session variables and work with those using the SESSION libray.

I am relatively inexperienced with PHP but am fluent with other languages,
so the concepts are not foreign, only the syntax.

So your guidance on the best way to pass an arbitrary number of variables
during the refresh would be most helpful to point me in the direction that I
need to focus my studies on.

thanks All!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация