Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Multiple Multiple Select Boxes


I'm looking to have multiple multiple-select-boxes on a page. But I
can only get the contents from the last selected value within a box,
via PHP. I've tried numerous methods. What am I doing wrong?

You can see ALL the values present in the url:
http://myserver/test.php?notify_use..._updcats=Update
e.g.......




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Multiple Drop Down Boxes
I want to create two multiple drop down boxes, the first will display all the company names, once this has been selected all the stock information for that company will appear in the second drop down boxes.

Handling Multiple Check Boxes
I have a PHP generated page which displays X many records. Each record has
a checkbox preceding it. The user checks several checkboxes, and hits a
delete button. All the corresponding records will be deleted.

But I'm running into difficulty...

Right now the NAME property of each check box is the primary key of the
corresponding record. Hence if I know which checkboxes are checked, I
simply use DELETE using the NAME value.

Generally speaking, how do I get the server side to see which check boxes
were checked?

The check box names may not be sequential, if any records have been deleted
previously, and the first check box might be a number greater than 0.

Is there an easy mechanism to do this? Some kind of built in cnotrol array
allowing me to loop over every check box that was on the form submitted?

I could store the last and first checkbox number in a hidden input, then
loop starting/ending at those values, but that may loop over a lot of
controls that do not exist.

Filtering Selection In Multiple Drop Down Boxes
I want to allow a user to conduct a search on a database using multiple drop down boxes.
On the first page they will have a drop box filled with records from field A. Once they select which one they want, a second drop down box will then appear with records from field B which are present for field A (a filter).

What I want though is that the first dwon down box still appears on the second page, but shows the record that the user selected. What is happening now is that when the second page comes up, the first box shows the default selection rather than the selection that the user chose. My code for the drop down boxes is: PHP Code:

How Can I Print Out Multiple Text Input Boxes?
How Can I Print Out Multiple Text Input Boxes. The function below prints out three text boxes. The code below is static, cannot accept user input, and therefore cannot be changed. What I need to do is write a function or maybe a class that can accept user input and print or echo a different number of text boxes, depending on the user input.

The name variable for each of the textboxes needs to have a different name. For example, the name for the first text box would be something like "name=textfield1", the second would be "name=textfield2", and so forth. PHP Code:

Auto-populating Multiple Boxes... Php And Pg_fetch_array Problem?
There is a nice tool using jquery/php to populate multiple select boxes out
there, it must be a very stupid question but I?m trying to apply this tool to get data from postgreSQL, but I always get an empty [] value. It means that the...

Multiple Select From Listbox And Execute A Sql Query Select Statement
Supposing i have a html form with 2 listbox and i name it status and resolution.

So it goes <select name='status[]'>... <select name='resolution[]'>

Then i have a another php page.
$status = $_POST['status'];
$resolution = $_POST['resolution'];

Now my question is, how do i do the sql query statement?

mysql_query("SELECT * from bugs where status=$status and resolution=$resolution");

The problem is, i select 3 options form the status listbox eg. new, closed, duplicate. And from the resolution, i chose fixed, invalid.

Posting Multiple Select
I'm having a little problem, in my form, I have to select multiple lines in a 'select' field and post it for processing.

Now in the $_POST-variable, there is only the last selected item visible.

How can I post every selected line?

Multiple Select Box Question
I have a list box on my page which I dynamically populate from the database. My question is, if I allow people to have multiple selections from this, how would I retreive the selections that they have made? example:- if I name the select box "Jobs", would i be able to do something like:- PHP Code:

Getting Multiple Data From <select>
Can anyone give me a quick hint for this?

Say, I have: <SELECT NAME="opt3" SIZE="15" multiple>

Then I'd like to list the items selected...
echo $_POST["opt3"];
but this gives only the first one

how do I get the rest?

List Box Multiple Select
I am trying to create a drop down list that permits a person to select multiple items from the list and have the results posted on a results page. I am using Dreamerweaver MX, PHP and a MYSQL database. I was able to select multiple items but only the last selected item would be displayed. I tried to modify the list box code and now it returns nothing. Code:

Select Multiple & Mysql
What's the sql should look like to get all possible data when using multiple select,
such as: <select name="hostfield[]" multiple> PHP Code:

Select Multiple Code
need to be able to generate a multiple select in a form using php and then write the reults to a relation table between a resource table and a look-up table..i.e.

table 1 list of resources

table 2 list of options for element in table 1

table 3 a many to many resolution table between table 1 and table 2

I can do this if only one option is select from a drop down list, code below:

PHP Code:

Retrieve Multiple Select
How to retrieve multiple selected value from select component with multiple
attribute?

Select Multiple In A Form
When using select multiple in a form how do I retain the highlighting of the selected highlighted values after the form has been submitted?

<select name="cities[]" size="4" multiple="multiple" style="font: 8pt Verdana" id="cities_id">

Multiple Tick-box Select
I have a list and what I would like to do with this list is have a tick-box next to each one, so someone can select multiple things out of the list. Then, once they click "submit", it displays just the things they selected.

The list in the data is displayed from a database by repeating the rows, so if there are 3 rows, it displays it in a table repeating the <tr><td><?=$thing?></td></tr> until it ends.

I know how to do forms, just not how to post only the selected data, to display it on a different page.

Multiple SELECT COUNT()'s In One Query?
I'm creating a script that, fairly often throughout, I need to use a SELECT COUNT() query on two seperate tables - this seems to be slowing the script down quite a bit, and if the script remains this slow, it won't be of much use to me...which would be very bad!

Is there anyway to combine these two to grab the COUNT() value from both in one query?

Select From Multiple Tables In Db From A Newbie
I have a db with 34 tables with all the same feilds, and would like to select 1 columb from all these tables. Is this possible from a select query, if so a example would be great.

You may well ask why have i 34 tables all the same, but i thought is was a good idea to set out the tables as per my catagories when i was constructing them. But now i know i can do them all from 1 table with multiple fields.

PHP Handling Of Multiple Select Fields
If I have a select element of a form that have the MULTIPLE attribute with name="temp", what will the variable names be in the action page (POST)? Will the first one be $temp[1], second $temp[2] and so one? This does not appear to be the case.

Multiple Select Box Search Queries
I am trying to create an elegant query together with a multiple select box, tbl_level linked by a foreign key. Sample code below:

$sql = "SELECT DISTINCT Firstname,.... FROM .... ";

//conditional statement to determine whether WHERE clause is needed
if($_POST["FirstName"] != "" {
$sql .= "WHERE ";
if($_POST["Firstname"] != "") {
$sql .= "Firstname LIKE
"".addslashes($_POST["Firstname"]).""" }

//select box entries array Level

if($_POST["Level"] != ""){
$i=0;$query.="( ";
foreach ($_POST["Level"] as $val{
if ($i >0){$query.= " AND ";}
$query .= "tbl_level.LevelCatID LIKE $val ";
$i=1;}
$query.=" )";
$query.= " AND tbl_name.NameID = tbl_level.NameID"; }
//query database

I can't use this as only a single Level select selection works, if user selects more , I can' t search the Level column for 2nd input from the select box using this. I am trying to avoid too many calls to the database, As I have several multiple select options for user to input for searching.Am trying to call single complex query at the end of code.

How To Update Select Multiple Menu??
how can i update the select multiple menu?? PHP Code:

Form Processing - Select Multiple
I'm trying to process a form that contains a SELECT with the MULTIPLE qualifier, but PHP only seems to be receiving the last selected entry in the list rather than all selected entries.

I tried parsing as an array (because the HTML definition says it should pass key pairs) but that gives me a run-time error saying the appropriate named variable isn't an array.
I've tried submitting to a script that displays php_info and the _POST vars entry lists just the single value.

I know that SELECT MULTIPLE is rarely used, but has anybody tried this before and encountered similar problems. any pointers on how to retrieve all the selected options gratefully received.

Multiple Select Box With Selected Option ...
first of all I have three tables (tournament_game, umpire_game, umpires). Updating tournament_game umpires, each game may have from two to four umpires, and those umpires can work from one to n number of games, that's why I'm using connection table umpire_game. I'd like to get selected multiple select box of umpires in game, it could be two to four options, with all umpires listed as options example:

<select name=umpire_game[] size=10 multiple>
<option value=$umpire_id>$umpire_name</option>
<option value=$umpire_id selected>$umpire_name</option>
<option value=$umpire_id selected>$umpire_name</option>
<option value=$umpire_id>$umpire_name</option>
<option value=$umpire_id selected>$umpire_name</option>
<option value=$umpire_id selected>$umpire_name</option>

PHP Code:

Retieving Data From Multiple Select
how can I insert data coming from a multiple select box knowing that I need
to insert other form fields at the same time.

<select name="auswahl[]" size="5" multiple>
<option value="bream">bream</option>
<option value="eel>eel</option>
<option value="pike>pike</option>
....
</select>

Multiple SELECT Queries Combined
I have several SELECT queries on a few of my webpages, and I have been told that the more query connections that are open the slower the server will run.

So firstly, is it possible to merge/combine 2 SELECT queries into a single query? Code:

Posting And Validating Multiple Select
i have a multiple drop down with five items.. If i select 2 or more items and post, only one item is posted to the db! How do I make it post all the fields I have selected? Code:

Changing From Single To Multiple Select
I have a poll script that I am in desperate need to let the users have more then one choice to the poll when they are voting...here is the original code below all i know is i have to change the type from radio to checkbox.. 

but other then that i'm totally lost, can anyone please give me the exact code i would need to change this I am still a real newbie as far as this stuff goes.. Code:

Multiple Select From Database Where Clause
I have a website with a database full of category names...I want to be able to chose lets say 5 of these categories and use a select from database clause where I could simply enter the category names I want to use but am not sure how I would go about doing it.

I can get the list to display just the Aprilia category using the code below:

$data1->q("SELECT * FROM categories WHERE cat_name = 'Aprilia' ORDER BY cat_name asc");

However...how could I get my site to display Aprilia, Ducati, Honda, Suzuki, Yamaha?

Mysql_query: Select From Multiple Fields
I'm writing a very basic search script. I have a form field where I want to accept both first and last names. In my database, the first and last names are in separate fields. I want the query to go through both fields and come up with results. Here is the PHP code so far (only searches first name):

$search = $_POST['search'];

$data = mysql_query("SELECT * FROM customers WHERE fname LIKE'%$search%'");

//Display results
while($result = mysql_fetch_array($data))
{
echo $result['fname'];
echo " ";
echo $result['lname'];
echo "<br>";
}

How can i change this around to perform the way I need?

Form: How To Read Array From Select-multiple
<form method="get">
<select name="users" multiple>
<option value="peter">peter</option>
<option value="paul">paul</option>
</select>
<input type="submit" value="select">
</form>

When I select both the string behind the URL is:

?users=peter&users=paul

How do I read BOTH variables?

Select And Display Multiple Queries / Results
Howdy all, i've been looking through various sites / tutorials and through this php book I have here to try figure out whats causing this problem but haven't had any luck yet.

The problem is that its displaying the Designation as the link url instead of the jcode. Hope i explained this well. Above this bit of code has calls the individual Catagorys, if theres data in that catagory it will display it with whats below. PHP Code:

Accessing The Contents Of A SELECT (multiple) Array?
Simple I would guess but since I've never used one of these I'm not sure how to get at it:

PHP Code:

<select name="chooseConcert" size=2 multiple>
<option value="Conversations">Conversations (September 12, 2002)</option>
<option value="Karla">Karla (various dates in October /Nov)</option>
</select>

I need to somehow determine (and print out) the contents if BOTH options are checked. I'm getting the contents using"

$HTTP_POST_VARS['chooseConcert']

I tried it once with both options checked and it only returned the second value. So what's the syntax?

Displaying Select Multiple Box And Using Mysql Join
i have an edit page where the query lists all the information from the database about a business. each business can have multiple types so i made a many-to-many database and now i need to be able to show all the types that are in the db for each business on the edit page. here is what i have so far but it's only selecting the last type of business in the result. PHP Code:

Insert Data From Multiple Select List
Am trying to insert data into a mysql database from a multiple select list. How would i do this? Code:

Retrieving Full Entry From Multiple Select List
I have a list box with multiple selects. I define the name as numList[]. I
get the values from

$picked = $_POST['numList'];

It retrieves values for all those selected.

If the entries are, say,
First
Second
Third

and the first and third are select then $picked[0] has "First" and
$picked[1] has "Third".
If, however, the entries are:

First one
Second one
Third one

Then the values are for $picked[0] and $picked[1] are "First" and "Third"
respecticely.
How do I retrieve the entire value and not just the first word?

Populating SELECT Multiple Form Field And Inserting Into Db
I have an update form where I'm trying to populate a SELECT multiple field with a list of 48 categories, from tbl work_cat. And show, as SELECTED, the one or many choices that the user had previously selected from the 48 categories which are stored in tbl cat_relations as $relation_cat.

Then allow the user to update their selections and update the database. But I can't get my form to work. First problem, I can't get the SELECT field on the form to show the categories, and then I don't know where to go from there. Below are my form page and my processing page. Code:

Showing Selected Items In A Multiple Select Menu
I have a form that has several multiple select menus. I would like to save the multiple selections but be able to show them as selected items when the form data is updated.

Selecting Multiple Values From Multiple Tables Using Checkboxes
I've been struggling with this for a bit but cannot seem to find a simpler, cleaner way of doing this.

a. I have a Table A - Customers , Table B - Contacts .
b. I have a form where a user types the first few alphabets of a customer name and then gets a list of contacts, cities.
c. The user is supposed to select multiple options from this list and then send that data to another form for processing.

I'm able to only pass data from Table A, not from B . Could someone please have a look at the 2 snippets of code and advise? And is there a way both these php scripts could be combined in a single one ? Code:

Grabbing Data From Multiple Tables For Multiple Requests
Here's what I'm trying to get at.

A table that displays all the Process Server's name, the number of summons's he has out within 7 days, 7-14 days and 15+ days...pretty simple, it's just a report so management can stay on top of how many papers are out.

I've got the server_information table with the server name and ID. and a case_information table with the serverID.

I've got a while loop that displays all the server's name, the problem is when I try to get the # of cases....here's what i've got so far. Code:

Multiple-combo - Multiple Mail Recipients
I am new to scripting but trying to create a page that lets users create an e-mail (mailto after having chosen from two drop-down menus (arrays).

I have managed to do so in HTML by using a Java script borrowed from Randall Wald (http://www.rwald.com).

However, I don't want the e-mail addresses to appear in the page to avoid spam. Is there a way to do so by using PHP?

P.S.: The first array contains (University A, University B) and the second array (Faculty, Staff, Students), i.e. 6 different e-mail addresses

To Search Multiple Words In Multiple Fields
I have a $phrase made of some words.Every query has a number variable of words. I would sort of my_table all records that have at least 1 word of the $phrase into field_a AND/OR field_b of my_table.

Multiple Users, Multiple Tables, One Form
I have a small group of users that will submit their 'goals' via one form (placed in a postnuke block). I have created one table (mysql) for each user to collect collect their goals. I need some direction in writing the php that will submit the form data to the correct table based upon the users Postnuke login.

Select Menu OnChange To Update Text Boxes
I've a select menu filled from mySql, So when I change the selection.. I want to change 3 text boxes also by the same row of database that is = to the row of the select menu.

So i tried a lot but failed.. cuz I cant send to javascript the updated values when the selected menu change.

Forms :: The "select Multiple" Is Evil
I'm writing a form with a "select" window called "choices" and when I send the form data to the next page, I end up with the last value selected in "choices."

I know that multiple selects are stored as arrays, but my problem is that PHP is only showing the last array element.

Ideas?

Here's the basic form code:
...
<form name="list" action="./print.php3" method=get >

<select name='choices' multiple size=10>
<option>hi</option>
<option>there</option>
<option>dude</option>
</select>
<input type=submit>
</form>
...

Problem With <select Multiple="true">
I have a form with a select element with multiple="true". When using the
GET method (I suppose the same happens with the POST method) I can seen
that the form sends channels=CH1&channels=CH2 when CH1 and CH2 have been
choosen. $_GET["channels"] gives me "CH2". Is there any way to get all
the choosen channels elements? ....

Multiple GETs W. The Same Name
The code I'm writing is using javascript and PHP.

Basically, it's a form that people add things to a drop down list w. javascript. The form is then submitted and all of the things in the drop down list (if selected) are submitted through GET (Which I will probably change later.)

I've done this before in PHP only where I could just assign an incrementer at the end of the "name" variable on each text field. However, I have multiple results going to the same "name" field now.

Here's an example of what shows when I do a print_r on $_REQUEST

mySelect = test

But my url looks like this
domain.com/document.phtml?mySelect=yep&mySelect=hey&mySelect=test

It grabs the last value, I understand that. Anyway to stop this behavior? Or am I just hoping for the impossible.

Multiple WHERE
I am trying to select things out of a MySQL database using PHP4. I am trying to search it so that two things match...here is what I mean... right now I have PHP Code:

"SELECT * FROM $table_name WHERE $where = '$where2' ORDER BY name"

Multiple Of 5?
I'm writing a new pagination script. The idea is to have blocks based on 5s. For an example:

<< Prev :: Page 2 of 8 :: Next >>
1 - [2] - 3 - 4 - 5

Then once you hit page 6 to 10 a new block is generated like so:

<< Prev :: Page 8 of 8 :: Next >>
6 - 7 - [8]

This is for an new kind of image gallery that I'm currently working on. 35 images are show at a time and at the bottom on the page there is the pagination. But How would I tell if a number is a multiple of 5?

Multiple Inserts
I am trying to do some multiple inserts using the following code but it doesn`t seem to work, it inserts the first one but then the second is inserted as blank. Where the value being passed is

$Emails="test@test.com, test1@test.com";

<?
// Get Login info

require("blah...");

// Connect to MySQL

$connection=mysql_connect($host, $user, $pass);

// Format the Emails

$Emails1=str_replace(" ","",$Emails);
$GetEmails=explode(",",$Emails1);

// Insert into Members Database

for ($a=0;$a<count($GetEmails);$a++){
$SQLStatement = "INSERT INTO Members (Email) VALUES ('".$GetEmails[$a] ."')" or die ("Problem");
$db = mysql_select_db($dbase, $connection);
$SQLResult = mysql_query($SQLStatement);

}

?>


Copyright © 2005-08 www.BigResource.com, All rights reserved