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.





Dropdown Select Option


I've sort of hit a roadblock. I'm working on a user system using PHP and MySQL. Where I'm stuck is on the "Edit User" page where the admin or user can go in and change the personal information of a user. Here's the dropdown menu.

<SELECT NAME="NameSuffix">
<OPTION VALUE="">SUFFIX</OPTION>
<OPTION VALUE=""></OPTION>
<OPTION VALUE="Jr.">Jr.</OPTION>
<OPTION VALUE="Sr.">Sr.</OPTION>
<OPTION VALUE="M.D.">M.D.</OPTION>
<OPTION VALUE="Ph.D">Ph.D</OPTION>
<OPTION VALUE="I">I</OPTION>
<OPTION VALUE="II">II</OPTION>
<OPTION VALUE="III">III</OPTION>
</SELECT>

<?php print("$data[6]");?> Gets me the database value from the NameSuffix field. Let's say, for example the value is "Sr.".




View Complete Forum Thread with Replies

Related Forum Messages:
Make A Dropdown Option Field For User To Select Date?
how can make a dropdown option field for user to select date?

View Replies !
Dynamic Dropdown And Hardcode Dropdown In Select Form
I have plenty of examples of dynamic dropdown choices but none of hardcoded dropdown choices. The ultimate goal is to have a job with various tasks and to track the status of those tasks for a given job. I've used one of the tutorials here to begin the process. Below is the code I have to add work on a given task. Perhaps I actually need to "Update" a job as opposed to "add".

But the problem of the moment is I can't seem to hardcode one set of my options. This is the code I have: PHP Code:

View Replies !
Option Dropdown
Im trying to create a "Select all" search Option dropdown form , but the options are stored the the database. Heres my original form:

<option value="<? echo $rst["id"]; ?>"><? echo $rst["cat_name"]; ?></option>

Basicly it has 20 or so options,  but no "search all" option. I had a play and came up with this but its adding the "select all" option every 2nd field:

<option value="<? echo $rst["id=all"]; ?>">All Categories</option>
<option value="<? echo $rst["id"]; ?>"><? echo $rst["cat_name"]; ?></option>

View Replies !
Select <option> </option>
I have this script in a form, it is trying to send a selection from the from to the next page. But the proble is that if the selection has a space in it, it only sends the first work to the next page. Code:

View Replies !
<select> Option
I know PHP is a server-side language, so it's not client-sided. What I want to do is have a <select> dropdown with options and I want the page to refresh itself and display some information on that option. The problem is that since PHP isn't client-sided, I don't know how to get the value of the selected option and display the relevant info on that option. Any ideas on how to do this with PHP?

View Replies !
Select Option
I want to load textarea's value in drop-down box.
In first page, such form is existed.

<form name="form1" method="post" action="next.php">
<textarea name="dayList" Id = "dayList" cols=20
rows=10></textarea>
</form>

in text area there's one column of values.

in "next.php", put values of 'dayList' in select option. I made a code
by myself. However, as you see, it's just nonsense. How can I modify
this? Code:

View Replies !
With Select Option
i am developing simple site for php where i put onle selct box,I have to check the value from the select box and put it in the database.I am having problem that if a value is alrady selectd , if you want to select it agin i have to prompt up the message that value is already selected.

View Replies !
Right Option In Select Box
I've a small problem but I can't fix it. When I want to edit an article I click on the article and you get redirect to a new page where you can change te values (title, category, author, etc). The categories are in a select box and I want to, when you edit an article, that the right category from that article is selected.

<select name="category" class="category">
<?php $allCategories = getAllCategories();
foreach ($allCategories as $category)
{?>
<option value="<?=$category['CATEGORY'];?>"><?=$category['CATEGORY'];?></option>
<?}?>
</select>


This is the MySQL below (a part of it) when I edit a page.

else
...............

View Replies !
Default Option On Select Box
I need to make a field in a admin form to be a drop down select box. I have the field right now as: PHP Code:

View Replies !
Drop Down Box With Select Option
I have a couple of drop down boxes which you select the option you want, that value is then stored in the database. If you make a mistake there is an edit option which once clicked shows the form with the information filled in/selected.

However my problem is that when you edit, although the current option which was previously entered into the drop down box is set as the starting value, which is disabled, if you dont change the drop down box the value is deleted rather than held as it hasnt changed. Code:

View Replies !
Remaining Value For Select Option
i've used $_SERVER[PHP_SELF] , so my form and script are just one file .
when a user click the submit and have some errors the sript reload again ,
for a reloaded script i've put :(for exaple)

<input type="text" name="username" value=$_POST[username] />

so when it reload the last information the uer has typed won't be delete.it stays.

i want to do the same with my "select menu " , i don't know how , the select menu reset when script reload :(example)

gender :
<select>
<option value="">select one</option>
<option value="m">male</option>
<option value="f">female</option>
</select>

View Replies !
Select/option Action?
I am trying to figure out how to click an option in a select menu and have that option act as a hyperlink/form submit without a submit button. Here is an example of what I am trying to do: Code:

View Replies !
Selecting Option In Select?
I am trying to populate a drop down list from values in an array, and compare a $_REQUEST or $_SESSION value to each of the array values. If they are equal, then the option in the drop down menu will be selected. Can't get it to work... Here is my code:

View Replies !
Select Data Into Option Box
Say I have a form

<select name="Birth_Month">
<option value="">(Month)</option>
<option value="01">Jan</option>
<option value="02">Feb</option>
<option value="03">Mar</option>
<option value="04">Apr</option>
<option value="05">May</option>
<option value="06">Jun</option>
<option value="07">Jul</option>

The user selected one field, and that field's value is stored in the mysql database. My question is, if the user wants to come back to the page, and select "Edit". .. Then he/she should get a form that his Birth_month's value has already been selected for him. I did the select * query

<?php echo "value="$row[6]"";?>>

The $row[6] is the row that contain that user's month info. But I don't know how can I use that row to insert into those option box?

View Replies !
Select Option And Htmlspecialchars
I'm trying to create a dropdown option that when selected goes to the url specified, I would also like specific data posted based on the selection Code:

View Replies !
Drop Down Select Box Which Contains The Option
I have a drop down select box which contains the option other beside this i have a tewxt input called "other_option " that can be filled in if other is selected. On my insert page this is the code i am trying to use to determin what goes into the database Code:

View Replies !
White Space In Select Option
I'm having a problem with a <select><option> which has white space in
values...

When I post the data I only get the first word (up to the white space).
"Testing white space" becomes "Testing" after posting

<select name="descr" id="descr">
<option value=Testing white space>Testing white space</option>
<option value=Testing white space two>Testing white space two</option>
<option value=Testing white space th>Testing white space th</option>
</select>

I am using form method = post and have also tried method = get

How do I get the full string from the value field.

View Replies !
Getting Right Order Of <option>s In <select> After Submit
I'm trying to emulate part of our client-server application as a web
site so customers can use it, and I'm stuck when it comes to
re-ordering items in a list.

Basically we have a list of available articles ("availableItems") and
a list of articles already in an issue ("selectedItems"). What I want
is to be able to move articles freely between the two lists and then
on submission add them to the issue (which I can), but also move items
in the "selectedItems" list around so that they can be re-ordered
(i.e. I want the customers to be able to change the order in which the
articles appear in the issue).

I can do both these things on screen (i.e. I have written Javascript
to move them from one box to the other (add/delete them from
"selectedItems") and to move individual articles up or down the list
of articles in the issue. Befor submitting I run a Javascript loop on
the list to select them all, from top to bottom. On screen it always
selects them in the right order (i.e. top to bottom, no matter whether
I have changed the order of these items) but when I grab the array
containing the item id numbers it's as if the change in order had
never happened!!!

Newly added or deleted papers get added/deleted fine, but when I fetch
the array from "selectedItems" I always end up with the items in the
same order, with the latest items added at the end. However, being
able to change the order of these items is crucial for this project,
but so far I have been unable to do this and I haven't found any
information on how to grab the new ORDER of items.

Here's some of the code:

I retrieve the array like this:

/*
$ia_items_new = $_POST['selectedItems'];
*/

However, this still lists the items in the OLD order:

/* if ($ia_items_old) {
foreach($ia_items_old as $key => $value) {
//echo("<BR>Old: No.".$key." - ".$value);
}
}
/*

Populating the "selectedItems" box:

/*
print( " <td><select multiple size=&#3920;'
" );
print( " id='selectedItems'
" );
print( " name='selectedItems[]'>
" );
//Grab values if the information was found
$in_total_count = $objRSIssueBatord->RecordCount();
$counter = 0;
if ($in_total_count > 0) {
//Now put in an entry for every value in the batting order list:
//Get the recordset ready and extract data:
$objRSIssueBatord->MoveFirst();
while (!($objRSIssueBatord->EOF)) {
$counter ++;
//Get the variables and make string to describe items
$in_paper_id = $objRSIssueBatord->fields("bip_paper_tracker_id");
$is_jsp = $objRSIssueBatord->fields("jsp_code");
$is_customer_no = $objRSIssueBatord->fields("pap_customer_no");
if (!$is_customer_no) $is_customer_no = "N/A";
$is_author = $objRSIssueBatord->fields("pap_author");

View Replies !
Simple - UD Function With Select / Option
As you might guess I am completely new to this language. Maybe I get some
help here.
I try to execute a user defined funciton from a select option in a document
to read a file
into an array without using a submit button or anything else.
like this:
<select name="sel[]" onchange="<?php ReadFile(DependingOnValue);<?" >
<option value="1"> 1st Quarter </option>
<option value="2"> 2nd Quarter </option>
<option value="3"> 3rd Quarter </option>
</select>

I know I could use Javascript instead. But I am sure there is an easy way
doing in PHP.

View Replies !
Keeping Select Option Value Selected
I'm trying to learn how to keep the value "selected" once a form is set to read the values and then f-write them (all within a loop). The part that's giving me a problem is the part which would return the value of the form as "selected". PHP Code:

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

View Replies !
Select Option Stays Selected
I have a normal drop down menu:

<select name="status" class="db_list_text">
                    <option value="All" selected="selected">All</option>
                    <option value="True">Active</option>
                    <option value="False">Inactive</option>
                  </select>
The idea for this is for the user to select either true or false and then to click submit to find data that matches either one. The coding is in the same page so the form basically just reloads the page and grabbes whatever info is requested. How can I with PHP, make it that the dropdown stays on the selected option when the page is reloaded?

View Replies !
If/Else Statment Within An Select/Option Group
I want to create an update query in a form so that I can update my groups attendance. The variables 100% are working and are pulling the correct info.  In the update attendance column, I would like an If else statement that says if the attend_status == present echo  SELECTED VALUE="", so that the pull down menu will display the current attendance value. From there I will select the new update attendance info and then submit it using an update query.

Below is the code. I am running into other problems with the quotation marks in such because this is all located within the <php> tags. Code:

View Replies !
Form Auto Select Option
I have a website that has a contact form with a dropdown list of names. I would like to code it so that when a user selects a person's name from another page, that when it brings them to the contact form, that name is automatically selected in the dropdown list.

View Replies !
Slide Bar To Select An Option On A Range Of 1 To 10
how on some surveys they give you a range from one to ten, where one is really bad and ten is really good. well, i am trying to code something like that where it is an arrow that you can move along a bar to select a number within that range. does anyone know if this can be done with php? and if so, how?

View Replies !
Convert CSVs To Select Option Values
I was just wondering if someone could point me to a good web resource that could help me figure out how to convert a string of comma separated values (being pulled from a database) into a select menu (pulldown box) so that the values from the CSV would automatically fill in the displayed text area of the option tags as well as the value attribute so the value selected could actually be passed as a variable.

I imagine it has something to do with converting the CSV list into an array using substring parsing & then dynamically building the array from the elements of the array, but I just haven't been able to put it all together yet. If anyone is familiar with anything published on the web that might help, I'd be deeply appreciative.

View Replies !
Form That Allows The User To Select A Sorting Option.
I have a form that allows the user to select a sorting option. One of the options is a day of the week. (The table is a list of courses and their times/locations/days.) I can get the results to sort by user option, but how do I make the days sort chronological rather than alpha if this is the option selected? This is my code:

$query = "SELECT * FROM classes ORDER BY '$schedule'";

The user selects which way to display the data through the $schedule variable.

View Replies !
Using Database Data For SELECT OPTION Statement
I want to use a <SELECT> / <OPTION> setup, and pull the data from a mysql database. I have done that, and don't necessarily have a problem with that. My problem is the database will have duplicate information in it, how do I only select one of each unique value? Code:

View Replies !
Automatic Selected Option + Select Menu
When the below menu is selected from it is processed by PHP code(PART II) I want the selected option to then be displayed automatically. However, the bottom option is automatically displayed. Code:

View Replies !
Select Box - Assign A Class To Each Option To Give Background
I have a select box coded that displays MySQL data as options in the pull down menu. What I need to know is if and how I can make it so that each option has given background. Can I assign a class to each option? The code for my select box looks like this: Code:

View Replies !
One DROPDOWN SELECT Control Can It Fill In 2 Textboxes?
I have a form with text boxes and a dropdown menu with names of cities
The adjacent textbox fills by the help of a Javascript function.
My question is, how to realize the purpose of filling the adjacent texbox
for zip values. Code:

View Replies !
Auto Select Dropdown Lists From Db Values
I want a simple HTML drop-down list like this: Code:

<select name="select_1">
<option name="option_1" value="option_1" selected="true">
<option name="option_2" value="option_2" selected="false">
</select>

to be able to automatically select a value according to a value in a table in the database. For example, if a MySQL table has a field named "field_1", and one of the rows has a value of "option_1" in that field, I want the list (using PHP of course) to automatically select the option name "option_1".

View Replies !
Selecting Current Month In Month Select Dropdown
I have set up a simple dropdown to list all the months a year from now and for the past year, so form July 2006 - Jun 2008. However, I am looking to have the current month as the selected option when the user first sees the page. Any ideas on how to do this? Code:

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

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

View Replies !
<option> &
I have an array like the one below PHP Code:

array(
1 => 'Apparal',
'Business',
'Game',
);

How can i get PHP to echo out an <option> tag for each value in that array. I want the key to be the value of the option, and the value to be what the option is.

<option value="key">Value</option>

View Replies !
<option>
If I know the text of an option (or the value) how can I get the option position/number? For example:

<select name="numfontype">
<option value="AARVC___.TTF">Aardvark Cafe</option>
<option value="Abduction.ttf">Abduction</option>
<option value="Adventure.ttf">Adventure</option>
<option value="air_mitalic.ttf">Air Millhouse</option>
</select>

View Replies !
Option Value
I'm tring to concat 2 columns from mysql. Lot and Unit. I have tried everything to get my code below to work.

<?
$mysql= "select concat(lot,''-'',unit) as t from production where community= '$community' ";
$query = mysql_query($mysql);
echo "LotUnit ";
echo "<select name="t" size="1">
";
while ($row=mysql_fetch_array($query)) {
echo "<option value="".mysql_result($query,$i,"t").""></option>
";
}
echo "</select>
";
?>

View Replies !
Add Option Modifiers
I am working on trying to create an admin for a product catalog, the only problem i am having involves product modifiers such as the ability to add size and color to the product that can also increase the cost of the product.

I was wondering if anyone would know a really good way of going around to do this, the only way I can think of is having a product option table that would hold the value of the modifier plus the cost plus the product id that this references too plus its own special id.

View Replies !
PHP GTK Option Questions
Before I invest more time in researching and testing I am curious if anyone knows for certain if a PHP_GTK application running on a Windows machine can communicate and interface with a remote database SECURELY?

My plan involves creating a support system which would be a standalone application on a Windows Workstation. This application would query data from a remote database SECURLY and then support personal would be able to modify, edit, etc. data from the PHP_GTK application which would in turn update data in the remote database, again securely.

Can a PHP_GTK application support this, security being the biggest concern?

View Replies !
Readdir & Option Value
more or less that is my problem:

i'm making HTML <select><option> statement:

if ($dir = @opendir("/the/directory)) {
while($file = readdir($dir)) {

echo '<option value="'.$file.'">'.$file;
}
}

the number of options depends of number of files in directory.

When user chooses one of this files(he chooses an option) i want to know
what option he choosen.

View Replies !
Option Button ?
I want to create a form with 3 groups of 2 options buttons (radio buttons in Dreamweaver). Can someone helps me in sending links to PHP Reference ? Example:

a > 0
Option(Yes) Option(No)

b > 0
Option(Yes) Option(No)

c > 0
Option(Yes) Option(No)

Submit Button Action of the submit button: If option_a_yes is checked (...) then open html.

View Replies !
Option Values
From my experimentation there seems to be a difference when using values from an option value as apposed to an value by a check box etc. I can quite easily input data from a check box selection, but not an option value. Code:

View Replies !
Remember Me Option
Any ideas on how to create a remember me option in a login box..?

View Replies !
Pagination Option
Below (A) is a portion of my pagination code where I specify the limit. What I'd like to do is add a select function (B) that will allow users to specify the limit. On change of select option, it should refresh with the new limit: Code:

View Replies !
Option Selection
I am making a Option Box (Drop down bar) for Gender, (Male,Female) and I want when they Select there Gener, and then hit submit, it Writes to to a Database.

i have it set it up so far that it goes to another page to INSERT it into the Databse.

View Replies !
Option Value Remember
When a user clicks on a car the option box selects what car has been choosed, after filling the form in and if he has forgotten to type some info, the script echos what did he forget, and the prob is, that the option value disappears.
How can i save the value or post it over? Code:

View Replies !
Put Attachments Option
how can i put a attachments option on my phpnuke forum i want people to be able to use attachments Mp3,wav.zip.pic.rar,and more.

what im doing a forum so people can battle Beats on the forum by puting attachments and people can download the beat or if it is posible to be no download youst click.

View Replies !
Cannot Do A Fopen With A 'w' Option In PHP
Using Mac OSX, I am trying to write a file to my local disk (create one also) and It keeps failing. I open and read an existing file, but cannot create or write. Does it have something to do with 'safe mode'? I have tried turning it off with ini-set(safe_mode,"off") with no luck and no result either. Have been programming for 25 years, but only a couple weeks in PHP and I'm stumped.

View Replies !
Add Formatting Option
I've developed this simple piece of script for my client so she can easy add news to her homepage from the admin Panel, I would like some advice on how i would go about adding some formatting options to the content in the textfield be, like bold, italic and linking tags etc. <html><head><title>Add News</title></head> . PHP Code:

<body>
<form action="" method="get">
<textarea name="newscontent"></textarea>
<br><br>
<input type="submit" name="Submit" value="Add"></form>
</body>
</html>

<?php

$Submit = $_GET['Submit'];

if(isset( $Submit )) {
.............

View Replies !
Option In Form
I have this HTML code

HTML Code:

<form method="POST" action="action.php">

<input type="submit" value="Address" name="B2" style="font-family: Verdana; font-size: 8pt; color: #FFFFFF; border: 1px solid #000000; background-color: #000000">

<input type="submit" value="Phone" name="B2" style="font-family: Verdana; font-size: 8pt; color: #FFFFFF; border: 1px solid #000000; background-color: #000000">

</form>

in action.php i want a code to run depending on which optoin was clicked ie: B! or B2, how can this be done?

View Replies !
Go Back Option
I need a code in php to go to the back page and display the contents which were their. I've only a table in the back page which contains the data derived from database. I've the present code as:

<input type="reset" value="Go Back" onclick="resetstr()">

and at the top of the page i've added before <html> the below script. I know its not working.Plz help.

<script language="javascript">
function resetstr()
{
parent.main.location.href="streaminfo.php"
}
</script>

View Replies !

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