Re: form variable name question

From: Date: Thu, 03 Jun 1999 14:56:21 +0000
Subject: Re: form variable name question
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-6516@lists.php.net to get a copy of this message
Colin Viebrock wrote: > > > This seems to work fine, except when you try using javascript with these > > variable names. Depending on what you are trying to do, javascript can > > come up with syntax errors with "[]" in the variable name, and there > > isn't an easy way around it. > > http://www.php.net/FAQ.php3#5.9 > > And, BTW, if you named all of your input the same, like in your example: > > <INPUT type=hidden name=user_ids value="123"> > <INPUT type=hidden name=user_ids value="456"> > <INPUT type=hidden name=user_ids value="789"> > > How would you access them in Javascript? You'd run into the same problems > I think. Ok, so you can use form element ids instead of variable names to get around the javascript issue. So the quesion remains: why was the decision made to require "[]" in the variable name? a convenience? Monte

« previous php.dev (#6516) next »