RE: [PHP] PHP_SELF NEW.....?????Continue2

2001-09-04 Thread Ardani Sarjito

Hi again!

Thank you for those who have reply my email.

Actually I'm trying to make a hangman game for my students.

I have seen one game written using PHP_SELF but I can't understand who it
works.

So, with the PHP_self (in my hangman game) I probably can send the value of
my variable to the same page. now my next question is:

How do i maintain the content of the page which is build based on the value
passed from the previous submision? Do I confuse you know?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF NEW.....?????Continue2

2001-09-04 Thread David Otton

On Mon, 3 Sep 2001 17:15:25 -0700, you wrote:

So, with the PHP_self (in my hangman game) I probably can send the value of
my variable to the same page. now my next question is:

How do i maintain the content of the page which is build based on the value
passed from the previous submision? Do I confuse you know?

I think this is what you are asking for :

?

if (isset($page)) {
/* variable page exists, so we are on the second page */
echo pThe string entered was : $input/p;
} else {
/* page does not exist, so we should display the form */
?

form method=post action=?=$PHP_SELF?
  input type=hidden name=page value=1
  Input : input type=text name=input
  input type=submit name=go value=Go!
/form

?
}

?

(Caution - I haven't tested this... could be typos)

If you want multiple pages, you can do this:

if (!isset($page)) {
/* do page 1 */
} else {
switch($page) {
case '1' :
/* do page 2 */
break;
case '2' :
/* do page 3 */
break;
default :
/* someone's messing with the URL string */
break;
}
}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]