473,396 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

retrieve selected value in select list

229 100+
Hi, I am trying to display a database value in a select dropdown list, as the selected. The following works only if there are no words with spaces between them. Does anyone know how to deal with this



Expand|Select|Wrap|Line Numbers
  1.   <option value="One two three" <?php if ($work_type== One two three) {echo "selected";} ?>>One two three</option>
Thanks in advance
Richard
Jul 12 '12 #1

✓ answered by Dormilich

yes, use quotes to mark a string (as intended). PHP is just nice and converts constants (text without quotes) into strings assuming you only forgot them.

1 1745
Dormilich
8,658 Expert Mod 8TB
yes, use quotes to mark a string (as intended). PHP is just nice and converts constants (text without quotes) into strings assuming you only forgot them.
Jul 13 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: asd | last post by:
I need to find the value/index of the previously selected item of a select list. That is, when the user selects an item from the list and a certain condition elsewhere in the form is not met, I...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
5
by: carrajo | last post by:
Hey, I'm trying to duplicate the following: Select List 1 --- Apple Orange Banana
4
by: rn5a | last post by:
A Form has 2 select lists. The 1st one whose size is 5 (meaning 5 options are shown at any given time) allows multiple selection whereas the 2nd one allows only 1 option to be selected at a time. ...
3
by: eshwaramoorthy | last post by:
Hi to all, I have one gridview with checkboxes which contains values of type integer(empid) and string(name) and if i checked it, those respective values must be displayed in other gridview.pls hlp...
4
by: semomaniz | last post by:
I have a list box that has a list of roles defined. List of roles are binded to the list box in page load event. I am trying to retrieve the selected role from the text box but i am getting a null...
1
by: AarthiVedhavalli | last post by:
Hi, In my C# web application I have a list box whic is binded to database. What i need now is , if i double click a value in list box that vale should be added to a dropdown list.. Any...
1
by: ashutoshjoshi10 | last post by:
Hi, I am using a Dijit.form.filteringSelect to display values using the dojox.data.QueryReadStore. But, after overriding _filterResponse() to format the data in a Dojo-parsable format, whatever...
1
by: VanZandt | last post by:
how do I get a cell value for selected qty? Please help!!! below is the code. Thanks, <?xml version = "1.0" encoding = "utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"...
1
by: Neerav shah | last post by:
How to retrieve selected value of dropdownlist filled from datasource in asp.net? Dim str1 As String = "SELECT UserName FROM Login WHERE Category = 'Property'" Dim cmd1 As New...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.