Re: [PHP-DB] how do I use same page for submit and results?

2003-02-06 Thread Joshua Stein
 But now I'm not using anything that I can check except for the
 button click. Any ideas how to do this?

assign a name to the button and check for that.

input type=submit name=action value=Show List

...

if ($_REQUEST[action] == Show List) {
   /* form was submitted */
   ...
} else {
   /* form hasn't been submitted, show it */
   ...
}


   -j.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] how do I use same page for submit and results?

2003-02-06 Thread Luke Woollard
or you can use check for the name of the submit button using a specific
SUPERGLOBAL array.

e.g.

if ( ! empty($_POST[submit]) ) {
   /* form was submitted */
} else {
   /* form hasn't been submitted, show it */
   echo 'form name=something method=post'
.' form fields/button goes here '
.'input type=submit name=submit value=send form'
.'/form';
}


Best to check if a variable exists

Using the other method will throw an error: Notice: Undefined index: action
in c:\program files\apache group\apache\htdocs\testerr.php on line x...



Thanks,

Luke Woollard








-Original Message-
From: Joshua Stein [mailto:[EMAIL PROTECTED]]
Sent: Friday, 7 February 2003 5:29 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] how do I use same page for submit and results?


 But now I'm not using anything that I can check except for the
 button click. Any ideas how to do this?

assign a name to the button and check for that.

input type=submit name=action value=Show List

...

if ($_REQUEST[action] == Show List) {
   /* form was submitted */
   ...
} else {
   /* form hasn't been submitted, show it */
   ...
}


   -j.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php