RE: JS refering to HTML/PHP arrays

From: Date: Tue, 09 Oct 2001 15:23:39 +0000
Subject: RE: JS refering to HTML/PHP arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70497@lists.php.net to get a copy of this message
> -----Original Message----- > From: Alexander Deruwe [mailto:a@deruwe.be] > Sent: Monday, October 08, 2001 10:07 AM > To: PHP General > Subject: JS refering to HTML/PHP arrays > > > Suppose I have these controls on a webpage: > > <input type="text" name="Array[name]"> > <input type="text" name="Array[firstname]"> > > etc ... > > How can I refer to these fields in JavaScript? I've set my stuff > up like this > because it's easy to be able to pass all input as one variable, > but now I'm > stuck here. You can always get to all of your variables from the predefined $HTTP_GET_VARS or $HTTP_POST_VARS arrays... so if your form had something like <input type='text' name='foo'> <input type='text' name='bar'> <input type='submit'> The script it submits to could access $HTTP_GET_VARS["foo"] and $HTTP_GET_VARS["bar"] (or $HTTP_POST_VARS["FOO"], etc, depending on what the <form> tag's method attribute is.) That would take care of the JavaScript problem while still providing one array for all the form variables. -Andy

« previous php.general (#70497) next »