Re: multiple selects into mysql database

From: Date: Thu, 24 Aug 2000 18:21:32 +0000
Subject: Re: multiple selects into mysql database
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-13480@lists.php.net to get a copy of this message
> I'm pretty sure the problem is because I don't know how to isolate the > multiple $discipline[] variable coming through. If anyone can help I'd > really appreciate it. In your <select multiple> tag, you are correct to assign its name as a PHP array. This is populated like so (and you are doing it correctly as far as I can tell): $array[0] is the value of the first <option> selected. $array[1] is the value of the second <option> selected. and so on... One thing I will mention: Unless you absolutely need the index to the array, use: foreach($array as $element) { ... } for 0-based arrays and foreach($array as $key => $value) { ... } for associative arrays. It makes reading code a lot easier. I understand the instinct to code C-like code, though. Dean.

« previous php.general (#13480) next »