storing combo box value

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vb_123
Forum Newbie
Posts: 19
Joined: Wed May 21, 2008 2:16 am

storing combo box value

Post by vb_123 »

hello friends,
i have a code like this :
<tr>
<td>Task Status :</td>
<td>
<select name="status">
<option value="juststarted">Just Started</option>
<option value="halfcompleted">Half Completed</option>
<option value="almostcompleted">Almost Completed</option>
<option value="completed">Completed</option>
</select>
</td>
</tr>

what is want is when i select a value from combo box (lets say completed) it should display as completed( and not the first value "just started").so how to use isset function for this.............thanx in advance
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: storing combo box value

Post by VladSun »

You'll need to generate this HTML:

Code: Select all

...<option value="completed" selected>Completed</option>...
There are 10 types of people in this world, those who understand binary and those who don't
vb_123
Forum Newbie
Posts: 19
Joined: Wed May 21, 2008 2:16 am

Re: storing combo box value

Post by vb_123 »

u r rite but what if i want to select any other value lets say almost completed then........that will not solve my purpose.......please suggest some other option
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: storing combo box value

Post by VladSun »

???
You decide what HTML has to be generated ... so, where is the problem?
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: storing combo box value

Post by JAB Creations »

Almost!

Two things...

1.) This is the PHP code forum and that is not PHP! This thread needs to be moved to the clientside forum. With 9 posts you should know this by now. :|

2.) VladSun is half correct but he's missing the value!

Code: Select all

<option attribute="value"></option><option selected="selected"></option>
I'm pretty sure you want to utilize JavaScript to execute a function when the user changes the value of the select menu.

Code: Select all

<select onchange="my_function();">

Code: Select all

my_function() {alert('The select menu\'s value has changed.');}
...of course you're going to need to learn how to reference things better in order to ask the questions to the required depth in order to receive the answers you desire.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: storing combo box value

Post by VladSun »

JAB Creations wrote:2.) VladSun is half correct but he's missing the value!
http://www.w3schools.com/Xhtml/xhtml_syntax.asp
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: storing combo box value

Post by RobertGonzalez »

How does this question have anything to do with PHP?
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: storing combo box value

Post by JAB Creations »

JAB Creations wrote:This thread needs to be moved to the clientside forum.
Thank you for noticing too. :mrgreen:
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: storing combo box value

Post by RobertGonzalez »

JAB Creations wrote:
JAB Creations wrote:This thread needs to be moved to the clientside forum.
Thank you for noticing too. :mrgreen:
There may be PHP involved, so I am giving the OP the benefit of the doubt.
Post Reply