Re: Multiple multiple selects
| From: | Erik | Date: | Mon, 17 Jul 2000 07:33:09 +0000 |
| Subject: | Re: Multiple multiple selects | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6885@lists.php.net to get a copy of this message | ||
So Steff (having come down off the lectern)
I poked through your code some more and a question arises:
obviously it is each() which is puking on the $$arrayName, so
what do you get by echoing $$arrayName immediately before
the while(list()) line ?
Another thought: can you get data out by building a print statment
that is driven off manual indexes into $othermemX[1], etc. [ in place of
the while(list() ) line ] ? (ie., is the data really there?)
HtH,
Regards,
Erik Stainsby
network tech by day
php hacker by night
beer drinker at any time
----- Original Message -----
From: "Steff Osborne" <sosborne@xuma.com>
To: "Steve Edberg" <sbedberg@ucdavis.edu>; <php-general@lists.php.net>
Sent: Sunday, July 16, 2000 10:46 PM
Subject: Re: [PHP] Multiple multiple selects
> Well, here's my code, which looks like it should work when help up against
> yours and Ray Street's:
>
> Printing the form -- the select box is printed over and over, so long as
> there's stuff in $statrow:
>
> <?
> $loop = 0;
> while ($statrow = mysql_fetch_array($statsql)) :
> $loop++;
> ?>
> <select name="othermem<? echo $loop; ?>[]" size="5" multiple>
> // Start
> select box
> <?
> $userssql = mysql_query("SELECT ID, FirstName, LastName FROM Users
> ORDER BY FirstName");
> while ($usersrow = mysql_fetch_array($userssql)) :
> printf("<option value=\"%s\"> %s %s\n", $usersrow["ID"],
> $usersrow["FirstName"], $usersrow["LastName"]);
> endwhile;
> ?>
> </select>
> <?
> endwhile;
> ?>
>
> Processing the form contents:
>
> <?
> $num = count($statID);
> for ($i = 0; $i < $num; ++$i) {
>
> $arrayName = "othermem" . $i;
> if (isset($$arrayName)) {
> while (list ($key, $val) = each ($$arrayName)) :
> $sql = mysql_query("INSERT INTO ProjectMembers (ID, StatusListID,
> UserID) VALUES (NULL, '$statID[$i]', '$val')");
> endwhile;
> }
> }
> ?>
>
> The error I'm getting is that $$arrayName is not an array.
>
> Any suggestions would be greatly appreciated. This thing has been driving
> me nuts for a week!!!
>
> Thanks again,
>
> -- Steff Osborne Sequential Tart Webzine
> http://www.webslayer.net/steff/ http://www.sequentialtart.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>