ØYstein HåLand wrote:
> Yes, you were right. Now a natural question. WHY? I don't understand
> your explanation, since I thought it was equal, getting a field value
> using document.answerform.name.value in javascript AND the variable
> $name in php.

If you submit a form, you will POST the variables to the same page (<FORM
NAME="answerform" METHOD=POST>).
The parser will only define variables at the start of a page. So, if you
POST a page, PHP will define all the variables for you.
What you are trying to do, is using the PHP variables before the form is
submitted. That means that the parser did NOT define the variables for you.
That makes sense, because the parser is running on the SERVER, and this
Javascript code is running on the CLIENT. The client doesn't have the
parser, so it can't define the variables for you.

So getting variables using Javascript and PHP is NOT equal. Getting them in
Javascript can be done by the client, like you do in your validation
function. Getting them in PHP can only be done by the server. You cannot use
these variables in Javascript code as $some_var.

HTH
Erwin



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

Reply via email to