Re: posting form values doesn't work

From: Date: Mon, 02 Sep 2002 09:59:41 +0000
Subject: Re: posting form values doesn't work
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-114892@lists.php.net to get a copy of this message
Ø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

« previous php.general (#114892) next »