Re: Php Form Issue

From: Date: Sun, 17 Nov 2002 03:00:57 +0000
Subject: Re: Php Form Issue
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-124758@lists.php.net to get a copy of this message
Put the brackets for php... <input type="whatever" name="myname[]" value="somevalue"> Now, to loop through the elements in JavaScript, you're going to have to do something like this.... var test = false; for ( i = 0; i < document.forms[0].elements['myname[]'].length; i++ ) //code for whatever you want to do here //if you want to check if at least one of the boxes are checked if ( document.forms[0].elements['myname[]'][i].checked ) { test = true; } } then you can just check to see if "test" is true or false...true if at least on box has been checked, false if none of the boxes have been checked. HTH Keith Spiller wrote:
Hello, I've managed to get a series of javascripts to work exactly as I wanted. They check all and uncheck all checkboxes with a single click of a control checkbox. Unfortunately, the information has to be sent to php. As soon as I add the [] brackets to an input name, the javascript no longer functions. I'll look up a javascript mailing list next, but I figured there must be some other way to get php to recieve the data and convert it to an array. Does anyone have an idea how I can make the php script gather all the multiple &browser=lynx&browser=mosaic&browser=explorer instead of only the last entry? Thanks for any help, Keith
-- By-Tor.com It's all about the Rush http://www.by-tor.com

« previous php.general (#124758) next »