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.





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 Ɖ' and hits the submit button (which posts to the same page). At that point, i'd like the combo box to still have Ɖ' selected, instead of resetting itself.




View Complete Forum Thread with Replies

Related Forum Messages:
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 !
Selected Combo Box
i have the following code and i am having problems with setting the combox to select the value that is stored in the database. i am hoping that the combo box selects the value and the value from the database is stored in $title PHP Code:

<?php
function displayedit($id,$title,$fn,$ln,$instit,$depart,$email,$url,$room,$phone) {  
echo '
  <form name="editform" method="post" action="editform.php">

  <p class="body"><b>Title:</b>'

    $t ="Dr","Professor","Mr", "Ms"
    echo "<select name='selectTitle'>";
    foreach ($t as $value) {
     echo "<option value="$tvalue"";

View Replies !
How To Create A Combo Box And Store The Selected Value In A Variable
does any 1 know how to create a combo box and store the selected value in a variable say $x? 

View Replies !
Showing Selected Parent
In my CMS, I have parent and children categories in one level and in one table (id, name, subcat).  What i would like to do is, in PHP of course:

Upon editing a category, in a dropdown box, show selected, the parent of the category.  if there is no parent, show selected, a message saying "Not a subcategory".  In the selection though, still shows the parent options as possible selections.
}

Can anyone help show me the right direction I need to go with this?  Do I need a join in my sql or do I need multiple sql queries? Moreso, how do I accomplish this after the query is completed?  I am not sure how to go about this.. Code:

View Replies !
Showing What Was Selected In Drop-down Menu
I'm trying to create a form where the user inputs data, i validate it with php, and if some of the input is missing or invalid then i print out errors with the form filled out with the information they entered/selected previously so they can change/add to it.

The problem I'm having is setting my drop down menus to be selected when the form is returned instead of returning their original state. The menu I have is named A ($A). Here's an example of what I'm doing that isn't working: PHP Code:

View Replies !
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.

View Replies !
Combo Box Values
I have values in a combo box where datas are coming
loaded dynamically. When an user selects a particular value and press search, even after refreshing the page, I want to keep the value same as the user selects. For example suppose if I selects
value PHP from combo box, after submitting the combo box should
value highlighted must be PHP. IS there any way I can do this?

View Replies !
Combo Box Call Out Values
I have a list of areas in a DB and want to call these out to a Combo Box:

id | area
----------------
1 |Slough
2 |Burnham

Now I thought the below code would output these, but it does not

PHP Code:

View Replies !
Minipulating Combo Box Values
I am working on a form and would like to minipulate the selected list item in a combo box. I am taking values from a record in MySQL and filling in form fields. Can I access the combo box like in JavaScript where you can do it like the following:

document.myform.combo1.value="myvalue"

or do I have to code the whole combobox in php like the following (I would really like to avoid it): *HTML Tags May Be A Little Off - Example Only. Code:

View Replies !
Insert Values Within Combo Box
I have an combo box and I want to make it insert the value we choose to the database.

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 !
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 !
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 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 !
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 !
Showing Folder List
I have a script where I can move a file and these functions list the folders and subfolders, and I'm trying to indent the subfolders each time. Code:

View Replies !
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 !
Radio Button - Reading Pre Selected Values From Db
I am able to make a selection of information when entering a record, with
radio buttons giving the option of yes, or no.

Which stores their answer as yes, or no in the database. I then have an
update record page that reads information in the database, and presently it
will not retrieve the previously selected option from the database. I have
tried all sorts of if else statements, and can't get anything to work. I
want the previously selected option to be selected when they are entering
the update page. Thus, they have the option to change it, but want their
previous setting selected so they are aware of their currently selected
option is.

<td width="50%"> <input type="radio" name="ud_digdocs" value="Yes">Yes
<input type="radio" name="ud_digdocs" value="No" checked>No

View Replies !
Rand() Returning Priviously Selected Values.
I am try to create a script that select a random entry in my DB and Then check a variable in that entry. If that varible is set the script will select a new random number.

The only probem is that it sometimes it selects the same random number as the last time it went through the loop. This would be fine except Sometimes the condition is never met, and no entry is selected.

I also can't make the script run till one is select since it will be eventualy set to a cron job. (So I limited the max number of times the script runs to the number of entries in my DB.) Code:

View Replies !
Store The Selected Checkbox Values In A Variable Or An Array?
how to store the selected checkbox values in a variable or an array?

View Replies !
Showing Values Of Tables
Here's the code I'm currently using:

In the page where the user selects the record from the main table to see the details of i use the following url (i think my url syntax is wrong):

$course_list .= "<a href="show_course.php?date_id=$date_id?department_id=$department_id">$course_name</a><br />";

Then, in the processing page where the details of the course are shown, I'm trying to use the following code snippet to get the department value from the related table:

$sql = "SELECT * FROM departments WHERE department_id = '$_GET[department_id]'";

$result = @mysql_query($sql,$connection) or die(mysql_error());

$department_main = $result;

further down I try to show the actual value:

<label for="department_id">Department: </label><? echo "$department_main"; ?><br />

What I'm getting is the numerical value for the department_id and not the department value from the department table.

View Replies !
Use A Button To Send Mail To The User That Is Currently Showing In The Drop-down List.
I am looking for suggestions for the best way to do this. I can hack it out
to make it happen, but I thought I would make use of the expertise to do it
the best way.

I have a form with a drop-down list of users. I want to use a button to
send mail to the user that is currently showing in the drop-down list. When
this button is pressed, I want the user's default email program to come up
with the email address of that person filled in. (the email addresses are
in the database and can be retrieved easily).

I can go to the process of having a separate mail form with a text box and
gathering all the info and then using mail() to send it. Or, I can have the
button exercise some code that runs separate window and exercises a mailto
in the html area with the address filled out and then kills the window,
leaving the user's email reader up there.

Both seem rather cumbersome. Is there an easier way?

View Replies !
List Values: Multiple Values
In dreamweaver I am trying to enter an "ALL" list value I have 3 labels and 3 corresponding values, but I am trying to create an option for the user to select "ALL"

Should I just enter:

1,2,3
in the value section

will this populate my recordset correctly ?
Is this the correct format to use for multiple values for a label ? Code:

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 !
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 !
List Row Values
I have rows of values stored in different mysql tables, linked by a primary key 'userid'.

I would like a snippet of code that will print a complete row of values for each person, separated by the table name and commas. This will help me combine the tables into excel later.

user1,TABLE1,1,0,1,1,TABLE2,1,1,1,0,0
user2,TABLE1,0,0,0,1,TABLE2,0,0,1,0,1

View Replies !
List Box Values
I am using a list box values which I want to preserve in all the pages and save it in Database:

<select name="select">
      <option selected="selected" value="FR">French</option>
      <option value="EN">English</option>
            </select>

How can I make the value save in a variable so that while user fills the form this value (from the list box) will be saved in db.

View Replies !
Scanning List Of Values
Say I have a list of values in an array:

Data_Field_1
Data_Field_2
Data_Field_3
Data_Field_4
Data_Field_6

How can i pick out that Data_Field_5, is missing out of this list? So Basically I need a formula that takes in a portion of the string (i.e. everything in front of the number) and scans the list of numbers and returns the first number that isn't in sequence. How would i do this?

View Replies !
Passing Values From List Box
I am able to populate my Countries Select Field in my form from 'Countries' table using this code after defining the RecordSet Query seperately.

=========================
<select name="country" id="country">
<?php
$result = mysql_query($query_country) or die("Could not run query.");
while ($answer = mysql_fetch_array($result)) {
extract($answer);
echo "<option>" .$country. "</option><br />
";
}
?>
</select>
=======================
The Countries table has two fields - Country & Country_ID.

How do I log the relevant Country_ID rather than the Country into the target table? Code:

View Replies !
How Do I Get An Ordered List Of Values To Print?
I have a database of my audio CD collection, and I'm trying to get the song titles of each album to print in an ordered list format. Each album is printed in a new table row.
For some reason a new row is printed for each song title.

Below is part of my script. I included what parts I thought were important. You can see the current output here. The output I want is available here. Notice that the song titles have a number next to them. PHP Code:

View Replies !
Dynamic Form - How To Set Values Of A List
I have a form with a list/menu in it that is populated with records from a database. The items in list#2 are based upon what is selected in list#1.

I have been able to use a combination of php and javascript to get it to work, but the javascript reloads the page to get list #2 to refresh - and that clears out any other fields that have been filled in. Instead of javascript being called for the 'onchange' event for list #1, I'd rather it call php when list#1 is changed and so reset the values in list#2.

OPTIONS:
1. I thought I could have a php function that is called (i.e.   onchange="<?php reload();?>" but I can't figure out how to set the values of the list from within the php function. How to reference form objects with php?

View Replies !
Multiple List Values To One Field
I'm trying to figure out if there is a way to input multiple selections from a list in a form field into one field in MySQL. Right now my list is only inputing the first value selected and not the others.

View Replies !
Detect Duplicate Values In A Ranked List
Spreadsheets like Excel do a nice job of detecting if there are duplicate values with their rank function - this is what I would like to mimic. This is my small script that detects the rank position of a variable Hank_Wins in a mysql database: PHP Code:

View Replies !
Retrieve Array From FORM List Of Values?
I have created a form where a user selects 2 items from a list of 8 values.
That form field is called "choices" and returns a value to the php file as
$choices. This form posed no problem when I only allowed a single item to be
selected, but the client now needs to have 2 items selected at a time.

The problem I'm having is that I don't know how to turn the multiple
selections on the form in to an array. I thought the $choices variable
would automatically become an array, but
Using[color=blue]
> for ( $i = 0; $i<2; $i++ )
> echo "$choices[$i] ";[/color]
only returns the first two letters of the last selected item value.

And
[color=blue]
> foreach($choices as $articles)
> echo $articles. ' ' ;[/color]

Returns an invalid argument.

While echo $choices returns the second item selected in the list, but not
the first.
It appears that the variable is replacing the first item selected with the
second rather than returning an array.

View Replies !
Popup Window List Of Values To Select
What i need to do is bring up a popup window with a list of values(values looked up from the database). The user should be able to select one of the values from the list and the value then populate a text box on the calling form.

View Replies !
Posting Form List Multiple Values ?
how to get the values using post from a multiple list form when more than one value is selected ?.. is it possible ?

View Replies !
Using Multiple Values From Dynamic Select List
I have a selection list which is dynamically populated from a SQL query. When the user makes their selection, the result is passed to the next page. 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 !
Combo Box Value
On my site, if you click on a link i want you to be taken to a contact form that contains a combo box, but what I want to do is predefine what value of a possible five selections is set... What is the best way of doing this?

View Replies !
If And While Combo
I want to combine an IF statement with a WHILE condition.. They work fine seperate but i can't seem to combine them the way i want. Look @ my code so far: Code:

View Replies !
Combo Box?
how to make combo box link with my database? I want my data appear when drag down the combo box Can someone help me with the code i should use???

View Replies !
Combo Box
I am allowing users insert data into a database using a form. I want one of the fields "department" to display all existing departments in the database in a combo box for users to choose from and also have a field in the combo box for them to add a new department. Is there a way for me to do this in using php? I am using php to access the database.

View Replies !
Combo
I have a combo box :

<select name="stock" id="stock">
<option value="In Stock">In Stock</option>
<option value="Not in Stock">Not in Stock</option>
<option value="Discontinued">Discontinued</option>
</select>

I am connecting to the database and i want to display the results in a form and change the value of the combo box to the one value in the database for that record. How would i set the combo box to the correct value using php.

View Replies !
Combo Box With ALL
In a combo box, I have the user select a company name and that name is then sent to the query. What I am trying to do is if no selection is made, the query would still run as if all the selections were made, returning all the companies which fall into that category. Do you know how to do this? I created an <option>ALL</option>, but cant figure out what its value should be?

View Replies !
Combo Box And Sql
can any1 give an example of a query being called from a database in sql and the result being stored in a combo box in php?

The code for a normal combo box sending the value as item is show below but i want the options to be from specifically in the databse.

<select name="item">
<option>Paint</option>
<option>Brushes</option>
<option>Erasers</option>
<?php
$_POST['item'];
?>

View Replies !
PHP/MySQL Combo
How come sometimes I get the following error:

Fatal error: out of dynamic memory in yy_create_buffer() in Unknown on line 0

My code works most of the time, its a combination of PHP and mySQL, i have no function named "yy_create_buffer". And the worst problem with this error message, is that when that error comes up, its the ONLY thing that comes up.

Other error messages at least they show up inside my page and they say what I specify the error messages to say. This type of error message would look totally unprofessional on the site I'm developing and I'm curious is there anyway to prevent this or somehow pinpoint the cause.

I'm starting to lose faith in PHP/mySQL . I'm starting to doubt whether the PHP environment is effective for a search engine which searches what will be a relatively large database.

View Replies !

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