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




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:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Is There A Way To Assign Multiple Variables A Single Value On A Single Line?
$f1, $f2, $f3 = Ƈ'
and
list($f1, $f2, $f3) = 1;

neither work... second obviously cuz its looking for an array on the right
side, correct?

Right now i have ot build a for loop to assign the values

Changing A Single Configuration Setting WITHOUT A New Php.ini?
I want to change the auto_append setting for my site, which is currently set to "no value". My server allows php.ini files, but I've heard there is a way to edit just one setting, in an actual PHP file, without making an entire php.ini, anyone know how to do it?

Mix Two Tables In A Single SELECT Statement - Not A Join
I have an Intranet with the organisation I work with. In this
organisation there are two departments - community department and press
office. Both the community department and press office have thier own
news system where they can add news in their own admin section that
will appear on their homepages. Both admin section have their own DB
table thus two seperate tables.

I would like to select all the rows from both tables in a single SELECT
statement so when I output them they will be integrated. This is not
the same as a table join as their are no keys and I want the rows from
both to remain seperate. Can this be done? Could someone please post an
example SQL statement demonstrating this if so?

Select Single Column From Mysql Into Array
Is there a way to select a single column from a mysql database and
directly put the results into an arrray? Here is the workaround below,
but I would like to elimniate the array_push step:

$uids=array();
$res = mysql_db_query("db", 'select uid from tbl;', $link);
while ($row = mysql_fetch_row($res)) {
array_push ($uids, $row[0]);

}

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.

Getting Multiple Emails From A Single Mail()...
I found an old thread on this (http://groups.google.com/group/alt.php/
browse_thread/thread/751edb9c723316c4/ea9bf92a9c6b807c?lnk=gst&q=mail()
+duplicate&rnum=7#ea9bf92a9c6b807c), but there didnt seem to be a
resolution. I also noticed that this was a pretty old thread and there
didn't seem to be anything newer in the search results.

Regardless, I have a very similar problem; I am consistently getting
five emails per each PHP mail() call. While this originally showed up
in a loop generating a flood of email, I explicitly made a single
direct mail call using hard coded strings and I confirmed the same
behavior. I have spent most of today fighting with this and I can
confidently rule out that the mail() function is being accidentally
called multiple times (unless PHP is reloading the page multiple times
before finally rendering back or something else really bizarre)

Here is an example:

$result = mail($sendto, $subject, $messagebody, $headers);

If it matters, this is being called via a wrapper function, like this:

function send_email($email_from, $email_to, $subject, $msg,
$show_result = null)
{
...
$headers = "From: $from
";
$headers .= "Reply-To: $from
";
...
$result = mail($sendto, $subject, $messagebody, $headers);
...
}

The values of the vars don't matter, as I ran a very simple mail with
hard coded strings and got exactly the same behavior.

I have searched extensively and I cant seem to find anything that
specifically nails down why this might happen. For those interested in
the mail headers generated by a single mail() call, here is what I get
(some data scrubbed out):

########################
Received: from crazycooter [67.110.67.194] by XXXXX.marketnet.com
(SMTPD-9.10) id A208038C; Wed, 01 Aug 2007 12:25:28 -0500
Date: Wed, 01 Aug 2007 12:25:17 -0500
Subject: Subject
To: YYYYY.ZZZZZ@MarketNet.com
From: AAAAA.BBBBB@MarketNet.com
Reply-To: AAAAA.BBBBB@MarketNet.com
Message-Id: <200708011225863.SM03756@crazycooter>
X-RCPT-TO: <YYYYY.ZZZZZ@MarketNet.com>
Status:
X-UIDL: 471469545
X-IMail-ThreadID: c208071f0000b881
########################
Received: from crazycooter [67.110.67.194] by XXXXX.marketnet.com
(SMTPD-9.10) id A2020370; Wed, 01 Aug 2007 12:25:22 -0500
Date: Wed, 01 Aug 2007 12:25:11 -0500
Subject: Subject
To: YYYYY.ZZZZZ@MarketNet.com
From: AAAAA.BBBBB@MarketNet.com
Reply-To: AAAAA.BBBBB@MarketNet.com
Message-Id: <200708011225800.SM02212@crazycooter>
X-RCPT-TO: <YYYYY.ZZZZZ@MarketNet.com>
Status:
X-UIDL: 471469541
X-IMail-ThreadID: c20100e10000b872
#######################

Select Statement With Changing Tables Base On User Selection
I am trying to make a select statement that would allow me to change the table, base on the user selection from a drop down menu list. I don't know if its possible or my syntax is wrong PHP:

sql = SELECT * FROM "'.$_POST[Tableselection].'" WHERE  "'.$_POST[userid].'" ='1';

Downloading Multiple Files In Single Zip File
I am developing the project management system.

Each Project:
1. Title, description ... , stored in mysql database
2. Upto ten files (initial description), (name in db, file in file
system)
3. Message board, stored in mysql database (1 file per message, message
in db, file in file system)

I need a link (Download Project) which will download all the project
related files, description, message board in the single zip file.

How To Restrict Multiple Login Using A Single Account.
In my project there is a requirement. If a user logged in at a time
since he/she logged out others are not allowed to loggin using the
same user name. That is to avoid multiple logins using a account. How
to do this?

I had got a idea and implemented.

1. When a user logs in storing the username, ip, login time to db.
2. When a User logs in i'll check the table whether the username
exists in the table or not if yes i'll not allow the user to login
else i'll allow to loggin.
3. When he logs out i'll delete the record from the table. Then he/
she can login again.

But there is a problem in this the user can close the browser directly
or right click in the taskbar and close it or by pressing Alt + F4. So
for this i have to catch the things in Javascript and trigger the
logout.

Is is possible to catch the events in Javascript, if yes please
provide me.

Or Is there any other method to restrict multiple login using single
account.

Single Database Transaction Across A Multiple HTTP Requests?
Does PHP have a feature to associate Cookie sessions with a persistent
database connection that will allow a single transaction across
multiple HTTP requests?

Here is how I imagine my process: I have an series of interactive HTML
forms. The user begins a Cookie session. A database connection is
opened and a transaction is begun. After the user goes through any
number of pages where they update the database they finish on a page
where they may commit or rollback the transaction.

This is not possible by default. PHP database connections implicitly
perform a commit or a rollback at the end of a script.

In other words, when I go to a page with a valid Cookie session I want
to be able to retrieve the same database connection I opened
previously. I don't want an automatic commit to be performed at the end
of the PHP script.

I'm using PostgreSQL. I'm aware of the difference between pg_pconnect()
and pg_connect(), but as I understand it this only does connection
pooling. It does not guarantee that you will get the SAME database
connection. Nor does it allow for transactions across multiple HTTP
requests. Am I wrong? Will pg_pconnect() do what I want?

I've seen some third party services that maintain databases connections
and allows them to be retrieved keyed to a Cookie. For example,
SQLRelay (http://sqlrelay.sourceforge.net/index.html), but this seems a
bit immature.

Inserting Then Extracting Multiple Values In Single Db Field.
I need to submit multiple values into a single table field that have been retrieved from a form eg: limit1 ... limit10. At the moment they are seperated by commas in the field (limit1,limit2 etc) thinking I extract these with explode() then assign them as individual variables ($limit1 etc.) so they can be edited by the same form.

Prevent Multiple Login For Single User Account?
how to prevent multiple login for single user account? eg user A login AccountA in german while user B also login AccountA in netherland(at the same time) that website.. how to prevent this? set login status in mysql or?

Need To Update Multiple Mysql Records With A Single Form Submit
I have a wish list like a shoping caty based on a mysql databse where i retrieve records with php I need to update the quantity which is in a text fields :

input type = text name = quantity[] value = $quantity
input type = checkbor value = $id name = id[]

I need to update quantities based on the primary id represented with id with a single submit.

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.......

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:

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.

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? ....

SELECT Error: No Database Selectedin Query: SELECT * FROM Schedule
I got the above error message after reading FAQ #10 which applied to my first error. The thing is, I thought I had selected a database. This script is copied from a tutorial, and I'm just too new at this to spot my error. PHP Code:

How Do You Interpret Single Quote Embedded In Double Quote Embedded In Single Quote?
I got the following example from http://www.evolt.org/article/User_F...0144/index.html
:

echo '<tr><td>First name:</td><td><input type="text" name="first_name"
value="'.htmlspecialchars($_POST['first_name']).'"></td></tr>'

What purpose do the single quotes serve in
value="'.htmlspecialchars($_POST['first_name']).'"

Select Statement - Select Random ID #
I have made up a page that pull info on 13 branches of stores onto one main page. It's basically there to display all the branches on one page... then you click on the one you're interested in and then you go to a more detailed page.

Back to the main page. On the top, there's kind of a featured branch that has a bigger picture and bigger title but it's still getting pul pulled from the same table etc etc etc.

In order for me to avoid favortism to one branch (and for other branches to start complaining) I want to ramdomized the order every time someone came to page but I have no idea how.

right now I have a super simple select statement.

Using Single Quotes
Is it a bad coding to use single quotes ' ' instead of " ??


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