Re: [PHP] Re: posting form values doesn't work

2002-09-03 Thread timo stamm

Hi Øystein,


PHP is interpreted on the server side, JS on the client side. I 
guess thats what you need to realize. Try starting with less 
complex stuff and just concentrate on one language at a time, in 
the beginning.


Timo


Am Montag den, 2. September 2002, um 17:49, schrieb Øystein 
Håland:
> So, why does it work some time mixing javascript and php, and not every
> time?


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




[PHP] Re: posting form values doesn't work

2002-09-03 Thread Erwin

Ø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 ().
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




[PHP] Re: posting form values doesn't work

2002-09-02 Thread Øystein Håland

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.
I still use php in the  location.href-part (it is as follows, the other was
faked: location.href=groups/answer.php
This opens the file groups/collectanswer.php.
So, why does it work some time mixing javascript and php, and not every
time?

"Erwin" <[EMAIL PROTECTED]> skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> ØYstein HåLand wrote:
> > This is my form:
> >  
> >   Your name:
> >   Group:  
> >> onClick="Javascript:validate(this);">  
> >
> > and the function validate:
> > function validate() {
>
> [ CUT Javascript code ]
>
> >   location.href='groups/collect_answer.php?name= > ?>&group=';
>
> [ CUT Javascript code ]
>
> At first I thought is was JavaScript/HTML code, but I can see a little bit
> PHP now ;-))
> The reason that it doens't work is simple. The variables are only
available
> AFTER posting the form. Not during validation!
> You should just use Javascript to fill in the name and group into the URL.
>
> Grtz Erwin
>
>



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




[PHP] Re: posting form values doesn't work

2002-09-02 Thread Erwin

ØYstein HåLand wrote:
> This is my form:
>  
>   Your name:
>   Group:  
>onClick="Javascript:validate(this);">  
>
> and the function validate:
> function validate() {

[ CUT Javascript code ]

>   location.href='groups/collect_answer.php?name= ?>&group=';

[ CUT Javascript code ]

At first I thought is was JavaScript/HTML code, but I can see a little bit
PHP now ;-))
The reason that it doens't work is simple. The variables are only available
AFTER posting the form. Not during validation!
You should just use Javascript to fill in the name and group into the URL.

Grtz Erwin



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




[PHP] Re: posting form values doesn't work

2002-08-31 Thread CHAILLAN Nicolas

This is not Javascript or HTML's newsgroup. You should read some docs about
PHP/HTML before doing that, you're currently using Javascript for nothing.

--
Merci de nous avoir choisi. - Thanks you for your choice.
Nicos - CHAILLAN Nicolas
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.GroupAKT.com - Hébergement Group.
www.WorldAKT.com - Hébergement de sites Internet
"ØYstein HåLand" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> This is my form:
>  
>   Your name:
>   Group:  
>   
>  
>
> and the function validate:
> function validate() {
>   var ok=true;
>  if (document.answerform.name.value=='') {
>   ok=false;
>   alert('Please write Your name')
>   document.answerform.name.focus();
>   document.answerform.name.select();
>  }
>  if (document.answerform.group.value=='') {
>   ok=false;
>   alert('What group?')
>   document.answerform.group.focus();
>   document.answerform.group.select();
>  }
>  if (ok==true) {
>   location.href='groups/collect_answer.php?name= ?>&group=';
>   return true;
>  } else { return false; }
> }
>
> and this doesn't work and I can't see why not
>
>



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