Re: Fields, Comboboxes, repost

From: Date: Fri, 16 Mar 2001 06:38:48 +0000
Subject: Re: Fields, Comboboxes, repost
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-44223@lists.php.net to get a copy of this message
>1. I am hoping to read the entire range of values from a field in my MySQL table into a combo >box on my form, but I am not sure how. On top of that, I want the user to select one value >from this list, press next, and the combo box reappears with the full list minus the chosen >value. The user then chooses another, presses next, and the combo box then appears again, >minus the two chosen values. This loop continues until flagged. > >Does anyone have any ideas how I can do this? <?php if (isset($selected)){ $selected_list = implode(', ', $selected); $where = " where not id in ($selected_list) "; } else{ $where = ''; } $query = "select id, whatever from blah $where "; $choices = mysql_query($query) or die(mysql_error()); echo "<SELECT NAME=selected>\n"; while (list($id, $whatever) = mysql_fetch_row($choices)){ echo "<OPTION $id>$whatever</OPTION>\n"; } echo "</SELECT>\n"; ?> >2. I have created a session variable $session. This is an array. I have a dynamic variable, >${"myvalue$counter"}, which has particular values assigned. The number of instances varies >depending on the data in the database, so it is difficult to go through and assign each value >to the session variable manually, eg $session["myvalue1"], $session["myvalue2"], etc. Is >there any way I can incorporate dynamic variable names into the array structure like above. >I have searched around, but I am not really sure what this would come under. It would probably be easier to just make a 2-D array instead of dealing with variable variables... >3. This is similar to above, but it refers to functions. Is it possible to have dynamic >function names that actually change from where you call it? > >eg. $value=1; >(call function from within another file) >function name$value (...) >$value=2; >(call same function from within the same file as before) >function name$value (...) You can *call* a variable-named function, but I don't think you can define them like that... -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#44223) next »