[thelist] php: problem with variable

Michael Galvin mpgalvin at eircom.net
Wed Jan 23 12:06:48 CST 2002


Chris/Mark

Both the name and type are "submit".  I understand about the hidden value
(and indeed if I were using ASP, that's the way I'd do it), but I'd still
have the same problem, in that if I set a hidden field 'test', then $test
would still be an undefined variable the first time I enter the form.

I guess Jason's "if (!isset($_POST['submitted']))" is the best way to do it.
Seems a little strange.  Was I correct in assuming that undefined variables
are a fairly recent addition to the php stable?

----- Original Message -----
From: "Chris Blessing" <webguy at mail.rit.edu>
To: <thelist at lists.evolt.org>
Sent: Wednesday, January 23, 2002 2:50 PM
Subject: RE: [thelist] php: problem with variable


| Hi Michael-
|
| Are you certain that the submit button is named "submit" and that the
"type"
| attribute for that element isn't what you were looking at?
|
| I try not to use that technique anyhow.  You can do some other things like
| add an "action" hidden input to your form (this is what I usually do) that
| says something more intuitive like "processEmail" and then check for that
to
| see if you actually process the form or display it (I just prefer this to
| checking for a button).
|
| Chris Blessing
| webguy at mail.rit.edu
| http://www.330i.net
|
| > Now I'm having some trouble with what appears to be undefined variables,
| > which I assume didn't cause much of a problem in whichever version of
php
| > this was originally written.
| >
| > I have an add.php which submits a form to itself.  So the first thing it
| > does is check for a variable called '$submit' which is the value of the
| > submit button.  If this is empty, it creates the form.  If not,
| > it does some
| > other stuff (not important).
|
|
| --
| For unsubscribe and other options, including
| the Tip Harvester and archive of TheList go to:
| http://lists.evolt.org Workers of the Web, evolt !
|
|





More information about the thelist mailing list