James Smith wrote:
>
> Alright, when i was programming with PHP3, I would use
> if statements like this:
>
> if(!$submit) {
> // display form
> } else {
> // display signup complete
> }
>
> to make multiple pages. Or I would do this:
>
> if($action == "signup") {
> if(!$submit) {
> //display form
> } else {
> // display signup complete
> }
> }
> if($action == "login") {
> // show login screen
> }
>
> But now I get an error like this:
>
> Warning: Undefined variable: submit in
> c:\apache\htdocs\test.php on line 3
>
> I don't know if I misconfigured my php.ini file or
> what.
>
Very likely you used the optimized version of php.ini which has global
variables
registration off.
As for your question, I can tell you my tip:
I use
<input type="submit" name="action[login]" value="Login">
<input type="submit" name="action[signup]" value="SignUp">
and in the form do:
$PV = $HTTP_POST_VARS;
$action = isset ($PV['action']) ? key($PV['action']) :
'<default-action-here>';
switch ($action) { // allows lots of action w/o too many ifs and such
case 'login':
// login
break;
case 'signup':
// signup
break;
case 'default-action':
default:
// evetually
break;
}
so on.
hope it helps
ciao
-- teodor
--
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]