Solved

Select Option Value

Posted on 2014-11-20
7
132 Views
Last Modified: 2014-11-20
If you have an HTML select element and an option like <option>--</option> and that is the default one selected, in the php processing program, does it pass "Null" as the value?

That is, is $_REQUEST['select name'] ==  "" ?

Thanks
0
Comment
Question by:Richard Korts
  • 4
  • 3
7 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40455552
If "--" is the displayed value then that is what is sent in the post/get
When no value attribute is set then the displayed value is used.
0
 

Author Comment

by:Richard Korts
ID: 40455597
Gary,

So to get "", I have to say <option value="">--</option>?

Thanks
0
 
LVL 58

Expert Comment

by:Gary
ID: 40455607
Yep
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Author Comment

by:Richard Korts
ID: 40455806
One more thing. If I am doing Javascript edits IN the html page with the form, is the javascript value of the form element "" or "--"?

Thanks
0
 
LVL 58

Expert Comment

by:Gary
ID: 40455853
Can be either.
With javascript to get the displayed value you use
.options[e.selectedIndex].text

And to get the option value you use
.options[e.selectedIndex].value
0
 

Author Comment

by:Richard Korts
ID: 40455910
So the value, if unspecified, would be null?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40455944
Yep
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question