On Mon, 6 Aug 2001 13:56:45 -0500, garman ([EMAIL PROTECTED])
>For all of my HTML forms, I put in some JavaScript to check and make
>sure no
>fields are left blank.  When the forms are processed in PHP, I also
>perform a
>check to make sure the forms fields aren't null (redundant, I know).
>Anyway, on a form I just made, both JavaScript and PHP think the
>form has been
>completed, even when the fields haven't been touched.
>The code basically looks like this:
><script language="JavaScript">
>function VerifyInput () {
>    if (document.myForm.input.value == "") {
>        alert ("form not complete");
>        return false;
>    } else {
>        return true;
>    }
>// -->
><form name="myForm" action="myscript.php" method="post"
>    VerifyInput()">

i can't tell if it's just a email formatting thing, but if there's a
line break in the onsubmit string it might mess things up.

><input type=text name="input" value="" size=30>
><input type=submit value="submit">
>Now, the file "myscript.php" will have something like this:
>if (!isset ($HTTP_POST_VARS['input'])) {
>    die ("form not complete.  cannot continue.");

well, if it makes it this far, $input will be set, but the value will
be "". try empty() instead of !isset()

- Mark

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]

Reply via email to