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/<?php echo $formname; ?>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:
> >  <FORM NAME="answerform" METHOD=POST>
> >   Your name:<BR><INPUT TYPE=TEXT NAME="name" SIZE=20>
> >   Group:<BR><INPUT TYPE=TEXT NAME="group" SIZE=8>&nbsp;&nbsp;
> >   <INPUT TYPE=BUTTON VALUE=" OK!"
> > onClick="Javascript:validate(this);">  </FORM>
> >
> > and the function validate:
> > function validate() {
>
> [ CUT Javascript code ]
>
> >   location.href='groups/collect_answer.php?name=<?php echo $name;
> > ?>&group=<?php echo $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

Reply via email to