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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





How Do You Do Selected In A Multi-value List Box In A Form?


I am populating a list box from a dictionary table and then picking
muliple values to insert into a detail table. How do I get the list box
to have multiple selections highlighted when I pick one of the master
items?




View Complete Forum Thread with Replies

Related Forum Messages:
List Box In Form Returns Index Number Not Value Of Selected Item
I have a form that contains a list box that is filled by an array. When the form is submitted, it returns the index number of the selected item of the array of items in the list box, not the value. The value is what I need, not the index number of the selected item. Code:

View Replies !
Multi Select Box Selected
i have two tables:

staff
------------
stid, staff
1| lien
2| tony
3| tom
4| henry

bill
----------
billid, stid

1| 1,3

i need for it to display all the staff from the staff table in a multiselect box then have the staff in the bill table selected. i can't figure out how to do this. Code:

View Replies !
Multiple Selected="selected" In A List.
I have a database with 1 to many and the many is a list with multiple
selects in a list. When I click on a master record I have as part of
my form the select statement for the multiple choice list. I want the
list to highlight the multiple chosen values. here is part of the
code.

$dresscat = specdresscat($dresstypeid); //this is the query to get the
values in the detail table
$drcatrow = pg_fetch_array($dresscat);// the array for the detail
table.
<select name="stages[]" multiple="multiple">
<?php
$allstages = allstages(); // this is a function to query my database
to get the value for the list.
while ($allstagerows=pg_fetch_array($allstages)) {
$eachstage= $allstagerows["stageid"];
$specstage= $drcatrow["stageid"]; // this is the point I need help
if ($specstage == $eachstage){ ?>
<option value=<?php echo $eachstage;?> selected="selected"><?php echo
allstagerows["stage"]?></option>
<?php }else{ ?>
<option value=<?php echo $eachstage;?>><?php echo
$allstagerows["stage"]?></option>
<?php
}
}
?>
</select>

View Replies !
Selected List Item Value
I know that the value for each element of my form is available through $_POST 'element_name'] but this doesn't work for lists. Can anyone tell me how I refer to the item selected in a list (combo box)?

View Replies !
Multi INSERT To MySQL Database From A Multi Input Form
I need to make a form like:

ID1 - TITLE1 {input=text}
ID2 - TITLE2 {input=text}
....
I'm gonna make changes some of the inputs not all of them. And when I submit form, changed rows will be inserted to another table. I think its an array and for loop thing but I couldnt figure out the code.

View Replies !
Html Pre-selected List Box Scrolled
Is it possible to have a list box with a pre-selected value automatically scrolled to that value when the form is loaded? i.e. if the size of the list box is 3, and the 4th value is pre-selected, I want the list box to appear starting at the 4th value in the form.

View Replies !
List All But Echo In Checkbox Only Selected
There is a 3 table: I want to list all the product groups but to be checked in checkbox only what choose the user.

If from outside (choos.php?tt_reg_id=1) user is nr 1 then in listed checkboxes need to be checked only those checkboxes what the user nr 1 choose / but listed the all product groups. Code:

View Replies !
Best Way To Show Selected Option In List Box
I need a way so that we can show selected option in list box without using if condition in loop since some times we have lot of options and we have too much if conditions to check.

View Replies !
User Selected Order Of List
My experience in php and mysql is just copying and pasting freebie scripts- very limited.
I'm wanting to create or better yet find another freebie script which will in my real estate site on the page with a table listing properties with headings such as
date/ type/beds/baths/price etc.

users be able to click on a heading which will then list the properties according to the selected heading, so if they choose 'type', the page will refresh and show all houses or land or apartments according to type grouped together and so on. First I think I need to have a link on the heading buttons to activate a php script which will send info to mysql database and if the database is configured right through the admin area it will respond accordingly. But what php script? How complicated could it be?

View Replies !
Dropdown List Selected By Default?
Does any one know how to have an item in the dropdown list selected by default?

$city_field = HTML_QuickForm::createElement('autocomplete', 'city', 'City', $cities);

$cities is an array of city names and I would like, say 'Los Angeles' selected by default.

View Replies !
Session Variable To Pass The Id Selected From A List?
I have a list which the user can select from in order to go to another page with details of the selection. I currently have the id of the selection being passed on the link as follows: PHP Code:

View Replies !
Transferring The Selected Record From The List Box To Textbox
Breifly, I've 3 list boxes.Select a record from the first one, click a button, the second list box is filled and select a record now and then click a button, the third list box is filled.Now, select the record, the selected record has to be shown in the text box.But, I also want to show one more field related to this one in another text box.How can i do??

well, the first list box shows the topic names, 2nd one the sub-topic names and the third one the article names. Now, when i select the article name, the article name and the article content has to be shown in the text boxes.

If its just article name, i know how to do it by java-script but i also need article content to be shown. Could somebody please help me how should i modify my code and where should i insert the text boxes?? Also, one more question, If i make any changes to the data in the text boxes, i would like to update.How can i do that?? PHP Code:

View Replies !
Combo/list Box Showing Values Selected
I have a combo box being populated dynamically through php using a mysql database, and everything works fine.

My question is: How would i make it keep the values selected, once the user hits the submit button? For example, let's say i have a combo box with the values 1 2 3 4 5 in it. The user selects &#393;' and hits the submit button (which posts to the same page). At that point, i'd like the combo box to still have &#393;' selected, instead of resetting itself.

View Replies !
Populating Drop Down List With Selected Vaue
I have a drop down box and the "selected" value needs to be selected by a dynamic value that gets entered into the database, this is currently how im doing it: PHP Code:

<?php
                if($modify_row[21] == "0") {
                  print "<option value=" "></option>";
                  print "<option value="1">Active</option>";
                  print "<option value="0" selected>In-Active</option>";
                } elseif ($modify_row[21] == "1") {
                  print "<option value=" "></option>";
                  print "<option value="1" selected>Active</option>";

Its fairly straight forward, basically the option that is automatically selected needs to be the one coming from the database $modify_row[21].

View Replies !
Multi-select List
I have a multi-select listbox created (and processed via PHP). As such I named it with braces in the name, like:

<select name="multilist[]" size=10 multiple>

However, I can't get javascript to reference the listbox when I name it that way (I need the javascript to dynamically insert/delete items from the list). I had originally named the list "multilist" without the braces and the javascript worked fine, and it let me multi-select, but php would only see the last item selected.

Based on hints I read elsewhere, to enable php to process the multi-selections into an array, I renamed the list with the braces [] but now the javascript simply does not work -- it will not insert data into the list. Is their any trick to the control naming I need to know?

View Replies !
How To Process Multi-select List
I'm not sure if my post should go here, but since I am using PHP, I figured I'd start here.

I have a table of choices that a user can select from, and can select as many as they want (it is for searching). I originally had a dummy list with checkboxes set up, and of course the name="name[]" was an array to capture each ID checked off, so I could easily use 'foreach'.

However, when the list was finalized, it has over 100 choices. Even half that would be too much for checkboxes. My two questions are:

1) Is there an alternative to a multi-select list, which is not that intuitive to use nor easily accessible?

2) How do I set it up so I can capture the values? I can't seem to find this answer anywhere. Is it because multi-select lists are to be avoided?

View Replies !
Multi-select List Boxes
I'm trying to allow the user to make multiple selections in a date list box. The list box displays the numeric days in the month. The offical scooty I can find on this is to do something like:

$theDays = $_POST['lboxDay'];
// get the data from the list box named "lboxDay" on the previous form.

$expDays = explode (",", $theDays);

This explodes the post data into an array of all the days selected in the list box, which are supposed to be delimited with a comma (the HTML standard). So, I should then be able to see those days with something like :

echo "<br />Day 0 = $expDays[0]";
echo "<br />Day 1 = $expDays[1]";
echo "<br />Day 2 = $expDays[2]";
.
.
.

View Replies !
Mail Form - Get The Form To Send The Selected Values
I've basically created a simple email form in html and used php scripting to send the form to my email. now I thought I should inlcude more options in this form to filter out some data I'm collecting in my emails. So i've now included some radio buttons and drop down list/menu. I've entered all the values and labels, the main question is how do I get the form to send the selected values along with the usual info i.e. name, address, email etc to my email? PHP Code:

<?
$mailto = 'john@something.co.uk' ;
$subject = "Feedback Form" ;

$formurl = "http://www.something.co.uk/contact.html" ;
$errorurl = "http://www.something.co.uk/error.html" ;
$thankyouurl = "http://www.something.co.uk/thanks.html" ;

$uself = 0;
.............................

View Replies !
How Do I Change The Drop Down List So The Option Selected Last Time Is Then The Current One Shown In The Drop Down Box?
I have a drop down list with the town options 'Bury' and 'Ipswich' as
shown below.

When selecting one of the options, its value is passed to variable
$townsearch.

How do I change the drop down list so the option selected last time is
then the current one shown in the drop down box?

<body>

<?php $townsearch = $_get['town']; ?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">

<select size="1" name="town">

<option>ipswich</option>
<option>bury</option>
&nbsp;
</select>&nbsp;

<input type="submit" value="GO" />

</form>

View Replies !
PHP And A Pre-selected Option In A Form
I've got a little text editor thing on my site, and to open a file, you input the file name and choose the folder from a drop-down list and click the Open button. The default filename is "index" and that file keeps track of all the files contained in that folder. It works okay. What's annoying is that regardless of what folder you're messing around in, the drop down list always goes back to showing the default folder name as the page is reloaded. I want it to be preselected to the folder it's in.

It seems simple enough--the folder you're in is $_GET['dir']. But I've read some HTML form how-tos, and I can only see that you can preselect using the tabindex="" or selected attribute.

View Replies !
How To Get Form To Remember Selected Option?
I am now trying to make a form remember which color (a select list) they selected before pressing any of the submit buttons. I entered this code into the form:

<select name="color">
<option value="red">red</option>
<option value="blue">blue</option>
</select>

The submit is a GET type. For example, if the user selects blue and then clicks on either one of the "submit" buttons, I want the form to remember/show the blue option. Right now the select list always goes back to red, the first choice. I tried doing a <?php echo $red; ?> and <?php echo $blue; ?> for the option value, but this does not work since the select list needs a value.

View Replies !
Get The Option Selected Once I Have Submitted The Form.
I am using the following code to loop 12 months backwards from the current month in a drop down list - using the get method.

I'm having difficulties trying to get the option selected once I have submitted the form.  For example, I am using this to filter months, so once a month has been selected and submitted, the first option in my drop down list is displayed and not the one that was selected and submitted. So basically, I need to be able to select a month > hit submit and when the form returns, have the drop down list show me the selected item. Code:

View Replies !
Setting Variables For Only The Selected Items In Form
when a form has a question where the response can be one or more selections either from a series of chech box inputs or a selection list, how would i set into variables only the responses that are checked or selected so that only these values are available for exporting to a mySQL database?

View Replies !
Make Selected Option Stay Selected In A Combo After Submit
I have 3 comboboxes, one for the day, other for the month and another one for the year. Every time i select a value for the three of them and press the "Submit" button, they reset to the default option. Anyway this can be solved?

View Replies !
PHP/MySQL: Query Based On Selected Form Option
Using PHP and MySQL. Trying to put a list of categories into a drop down
select option of a form like:

<form name="form" action="<? print $_SERVER['PHP_SELF']?>" method="get">
<select name="subject">
<option value=""></option>
<option value="field1">Field 1</option>
<option value="field2">Field 2</option>
</select>

<input type="submit" name="Submit" />
</form>

Then I want to process it so the MySQL query gets done depending on what
was selected. I came up with this:

//connect to database
mysql_connect("$dbhost","$dbuser","$dbpass");
mysql_select_db("$dbase") or die("Unable to select database");

// Build SQL Query
if (isset($_GET['subject']))
{
switch($_GET['subject'])
{
case 'field1':
$query = "select * from tips where category = 'field1'";
break;
case 'field2':
$query = "select * from tips where text like 'field2' ";
break;
default:
echo 'No subject found'
}
}

$results=mysql_query($query);
$numrows=mysql_num_rows($results);

etc etc etc

But that switch doesn't seem to work. Anyone have a suggestion as to how
I can code this to do the MySQL query based on the subject?

View Replies !
Multi-form Variables
I have read quite a few posts and can't seem to find the answer to my question. I need to be able to pass from fields to PHP from severel different forms on a page. I have had to create multiple forms because I am dynamically adding and subtracting form elememts of
various types in javascript based on user activity.

My problem now is getting all of these different form fields to PHP so I can write them
to MySQL. I am open to any suggestions and will try using cookies, javascript arrays, hidden form fields, or whatever it takes. The only drawback is I have to use multiple forms so combining forms is not an option.

View Replies !
Multi-page Form
I have an application form consisting of nine pages. They would like to have the application to be completed on the website.

Rather than having one long scrolling screen of questions, is it possible to have questions from page 1 appear, then click a link Next Page link for page 2 and show those questions, then click a Next Page link for page 3 questions, etc.?

View Replies !
PHP Multi Level Form
Is there a php script I can use that if you select a certain question it displays a set of other or extra questions. should I rather be looking for something like this in a JavaScript.

View Replies !
Multi User Form Search
I have a multi page form that creates forms on the fly and keeps an array of values as you move through the code. I want to store these values as the pages are created so I can incorporate a User Search that automatically fills out the form information from a mysql database query. The program logic is fairly straight forward.

I am try to figure out the best way to save the variables as it moves through the dynamic pages. I want to be able to do a database search and return to the same instance of the page that it originated from. Sessions and Cookies both give me Header Cache errors.
Code:

View Replies !
How To Update MYSQL From Multi Row Form
I'm trying to update rows in MySQL using a dynamically generated form. PHP Code:

View Replies !
Multi-tier Form Validation
I can program the validation functions, but am having trouble integrating them into my web page. I have a few books, but their examples are somewhat trivial in that they tell you how to validate the form, and the success event is something like a 'YOU WERE SUCCESSFUL' message. What I need to do upon successful validation is enter some data into a database or move on to the next form.

I could use some examples of what I would call multi-tier form validation where the user would log in, and then have to successfully navigate several forms. Do I do this all with PHP_SELF or do I call each form as a separate page? The problem I have had with some of the books is that their examples are not exactly what I would call 'real world'.

View Replies !
Multi Page Form & Redirect
I have a multi page form that I carry over hidden fields from one page to the other. I've used the fieldforwarder script, and also tried using sessions. However, when the form is posted, and I redirect to a thank you page, I loose the form field information.

I would like to carry parts of that form information to the thank you page, but can't seem to figure out a way to do it. I thought about cookies, but more and more people are not allowing them. What would be the best way to do this? Is there a tutorial somewhere?

View Replies !
Passing Data To Multi Use Form
I am working on a site where I need to create forms to both add and edit
information for a group of products. I would like to use the same form for
both adding new and edit data for existing products, while at the same time
separating data and presentation functions.

So when the user selects the
option to add a new product, the form comes up with all drop down lists
filled from the database with the options for that field and all other
fields blank, and when a product is selected to be edited, I would like the
same form to come up, but this time with all the fields filled in, including
all drop down lists filled with the appropriate value for that product. Code:

View Replies !
Multi-tabbed AJAX Form
I'm working on a multi-tabbed AJAX form. Each tab has it's own name to pass values (ie. FB[] ). Once the form is submitted, the resulting $_GET is something like this: Code:

View Replies !
Trying To Build Multi-page Form
I have a 20 field form that I'd like to break down into 4 "pages" for a better user experience. I've been advised that PHP is the way to go.

I've searched the web for days trying to find software that...
1) can build a multi-page form
2) the form is not hosted on another site
3) I can own the software not pay by the month
4) can handle "if" scenarios, as in if client picks "A" then they get different fields than if they pick "B"
5) Doesn't charge extra fees for extra sites

Well I can't find it anywhere. So apparently this is a pretty tall order. Any ideas?

View Replies !
Multi Step Web Form Or Wizards ?
I would need to create a multi step web form like a Windows wizard, with Next and Back buttons. Around 8 steps with many fields and validations between steps.

Any freeware package available? If not, suggestions on how to code it? Using Internet information Web Server and PHP 4.4.1.

View Replies !
Multi-pages Form Using Session Variables
I am trying to break a very lengthy php form into several pages but I am having some problems partly b/c For testing purposes I created 3 very simple forms: page1.php, page2.php and page3.php which shows contents from page1 and page2. Eventually I would like to send this data to the database. PHP Code:

View Replies !
GET / POST Conflict In A Multi-page Form.
Wonder if anyone can help with this problem:

I am using an app with several pages, using a session to track vars
between the pages, and using an image map to re-direct back and
forwards between the pages.

The way I redirect is when the image map is clicked on, it posts to a
page called 'control.php' which passes the POST vars to the
corresponding SESSION variables, then redirects to another page, based
upon the co-ords of where the image map was clicked upon.

I have added text links at the bottom of the page:

i.e.

<--- previous page

----> next page

but because the image map POSTs the data to 'control.php', I can't
really add a GET query string to the link at the bottom of the page,
because nothing will be POSTed.

....But then again, I can't add a POST link to the HREF, because it
won't pass the co-ords, and I can't add a special variable to identify
the link to the control form -i.e. control.php?link=3 (as I could with
a GET) and re-direct accordingly.

So, after hours of thinking about this, I'm stumped.

The only idea I have is to hack the image map up into smaller pieces,
add ALT tags to each one, and make do with it - or add NEXT and
PREVIOUS submit images at the bottom of the page too.

If I make do one with large image map, it is no use to someone who is
visually impaired and relies on ALT wordings.

Is there any possible way to achieve what I am trying to do ?

View Replies !
Posting Multi-line Form To MySQL
cutting/pasting etc and have a basic idea and recognition of php functions. That said, I am trying to hack together a php function using smarty which will allow me to input a list of names into an existing sql table using a multi-line form. Code:

View Replies !
Multi-line Input Form And MySQL
I have a form with multi-line input fields that I would like to same in MySQL table (each line will be a record in the table). The form has the following fields:

Hidden id field called id
First Name called fName
Last Name called lName

The form has 10 lines - each line has a unique hidden id value. The other two fields each has the same name and value on each of the 10 lines.

When the user clicks the submit button, I would like to go throught the $_POST value and group each line in an array and save it to the MySQL table called client.

View Replies !
Basic Multi-form Database Upload Question
I'm learning php and mysql. As an exercise, and in order to create something I need, I am building a page builder.

So how would the following process take place best with php and mysql?

I have a series of form pages containing inputs for collecting information that will be used to build a 'breeder listing' page.

Once the user has filled in each page and submits the third page, he will be sent to a review page showing how his listing page will look except with an 'Upload' button and an 'edit' button, allowing him to review his page.

This will then create a new page.

If I understood how this process is done, I can look up all the details, but I'm confused on the process.

View Replies !
Multi Page Form Question Concerning $id = Mysql Insert Id();
I am creating a multi page form. The code below is what I am using. However, I am having a difficult time having it post to MySQL under "pg2" where it posts to MySQL I have the function $id = mysql_insert_id(); to post the id from "pg1" post to the database. However it only post 0 which I think is due to it being in an array. Code:

View Replies !
Detect What Option The User Selected And Then Direct That User To The Selected Page.
Quick question regarding HTML forms and select fields. I want to be able to detect what option the user selected and then direct that user to the selected page.

<select>
<option name="1">1.html</option>
<option name="2">2.html</option>
</select>

when the user selects, 1.html, it'll direct them to http://www.domain.com/1.html same with 2.html. I wasn't sure if this was done with PHP or Javascript, if its possible on both, which is better?

View Replies !
Processing Data From Multiple Multi-line Textareas Into A Multi-dimensional Array
I know that this sounds like something overly complex - because it is.
However, if I can keep the user interface the way it is, my users will
be ultra happy! That is the goal...

In general, this is an inventory receiving piece of an overall larger
web-based ERP system.

What I have is a form in which I have a dynamic number of multline
textareas for inputting (possibly barcode scanning in) many serial
numbers per line item recieved.

For example:
lineitem01 = widget01; qtyReceived = 2;
lineitem02 = widget02; qtyReceived = 3;
lineitem03 = widget03; qtyReceived = 10;

This would display a form that will generate 3 textarea elements (1
per lineitem received). Inside each textarea element will be input the
serial numbers for each of the widgets received per lineitem. i.e. 2
serial numbers will be entered for widget01; 3 for widget02; and 10
for widget03;

So, what I am trying to do is pass this data over, possibly as a multi-
dimensional array to another form ( or possibly $_SERVER['PHP_SELF'] ) to update a MySQL database to store the widget/serial numbers.

View Replies !
Structure Of Multi-user/multi-section Admin
I'm trying to work out how to structure a multi-user/multi-section admin and it's a bit of a puzzle Here's the set-up I need:

There are two types of Admin : superadmin and admin - the superadmin has access to all but the normal admins are limited to what they can see - and it's the superadmin who sets the permissions.

The site has 5 dynamic sections (this doen't change) and inside each section there are a variable number of subsections that are managed by the superadmin Code:

View Replies !
Multi Sorting Multi Dimensional Array?
I have been using usort to sort my multi dimensional arrays ...

function cmp($a, $b){
if($a[0] == $b[0]){
return 0;
}
return ($a[0] < $b[0]) ? -1 : 1;
}
usort($searchResults, 'cmp');

Which works fine, but I need to sort by one element in the array, then
another, preserving the previous sort.

lets say the array is as follows:

array[0] = array[0] = foo
[1] = 2
[1] = array[0] = foo
[1] = 0
[2] = array[0] = bar
[1] = 1
[3] = array[0] = bar
[1] = 0
[4] = array[0] = foo
[1] = 1
[5] = array[0] = bar
[1] = 2

Initially, I sort the array in to groups based on array[?][0] using
usort as above so the output is :

foo, 2
foo, 0
foo, 1
bar, 1
bar, 2
bar, 0

Next though, I would like to sort this output by number (array[?][1])
in the groups so that the output is :

foo, 0
foo, 1
foo, 2
bar, 0
bar, 1
bar, 2

Is this possible? I am completely at a loss as to how to do this ...

View Replies !
List Subscribe Form
trying to make a simple subscribe form for an email list like so...

$to = "news-subscribe@mysite.org";
mail($to, "subscribe", "subscribe", "From:$subscribe
Reply-To:$subscribe");

but the email list never confirms the subscription by email so can't figure out whether its getting the email or not? nether the subject or body text are necessary, its the address that does the command, any ideas anyone?

View Replies !
Form Entry List
I have a form with one box into which users type a few words (an email address).

That entry is emailed to me. I need to copy each entry into one text file automatically so I do not have to copy them manually out of each email one at a time. The result would be one text file with the entries listed down the page, one by one.

View Replies !
Change List Value In Form
I want to have in a form a list element that gives you the opportunity to choose between "taken" and "not taken". At the beginning the list value is on "not taken".

What I want know is that when a costumer clicks on the list value taken and then submits the form that then the web page will be updated so that the next visitor who visits the page sees that that item has already been "taken". Code:

View Replies !
PRODUCT LIST FORM
I have a form that loops out a list of products from a mySQL database. beside each product is 2 checkboxes. one is for deleting and another is for selecting a product to go into a storefront.

on the second page I have a implode() to seperate each product with commas. then it puts the list into a query and deletes them one by one.

my problem is the only way to use a implode is to use $_POST by itself without the element ($_POST['var'])

what if the user checks some boxes to put into the storefront and checks some boxes to delete. how can i filter the two so i wont get them mixed up and end up deleting something that probably was suppose to be stored in the storefron.

View Replies !
Mailing List Form
I want to have a form that is submitted and the message sent out to a list of 50 or more people. How would I do this?

View Replies !
A Form Menu List
I have a date of birth script on my website and at the moment im faced with typing in about 100 dates ranging from 1900 to 2006 is their any way i could use php to create the range of dates in a form menu list?

View Replies !

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