Connecting Tech Pros Worldwide Forums | Help | Site Map

Combo Box problem

Member
 
Join Date: Oct 2006
Posts: 102
#1: Aug 16 '08
i need to know how to get the selected value from a combo box in php
for example :
Expand|Select|Wrap|Line Numbers
  1. while($row=mysql_fetch_array($query))
  2.        {
  3.           echo"<option value='category'>".$row["cat_name"]."</option>";
  4.  
  5.            }
i want in another page to get the selected value and perform some operation on it
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#2: Aug 16 '08

re: Combo Box problem


Assuming you are sending via POST you can retrieve the option selected from the POST array using the name you gave the SELECT element.
Member
 
Join Date: Oct 2006
Posts: 102
#3: Aug 16 '08

re: Combo Box problem


I tried this but its not working
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#4: Aug 16 '08

re: Combo Box problem


Quote:

Originally Posted by jessy

I tried this but its not working

Show us what you have tried..
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#5: Aug 16 '08

re: Combo Box problem


Jessy, you've been asked *several* times to use CODE tags when posting source code. You've been warned that further violations of the site Posting Guidelines will result in account suspension.

Which is why your account has been suspended for 1 week.

Thanks for your time.

pbmods
samikhan83's Avatar
Member
 
Join Date: Sep 2007
Posts: 33
#6: Aug 17 '08

re: Combo Box problem


hi....
1. check that ur get ur desired value from database.

2. there is no use of using concatination operator when u are using echo " " of php... bcoz php interpreter will differentiate wat is variable and text.....
when u are using echo ' ' u have to use it......

3. u will get ur value with
Expand|Select|Wrap|Line Numbers
  1.  $value = $_POST["FIELD_NAME"];
4. FIELD_NAME should be ur combo box name... no combo box id..
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#7: Aug 17 '08

re: Combo Box problem


Quote:

Originally Posted by samikhan83

hi....
1. check that ur get ur desired value from database.

2. there is no use of using concatination operator when u are using echo " " of php... bcoz php interpreter will differentiate wat is variable and text.....
when u are using echo ' ' u have to use it......

3. u will get ur value with

Expand|Select|Wrap|Line Numbers
  1.  $value = $_POST["FIELD_NAME"];
4. FIELD_NAME should be ur combo box name... no combo box id..

1. ???

2. Wrong. The way he/she has used the echo statement is perfectly fine. Double quotes DOES support concatenation.

3. FIELD_NAME should be the name of the SELECT element.
samikhan83's Avatar
Member
 
Join Date: Sep 2007
Posts: 33
#8: Aug 17 '08

re: Combo Box problem


Quote:

Originally Posted by markusn00b

1. ???

2. Wrong. The way he/she has used the echo statement is perfectly fine. Double quotes DOES support concatenation.

3. FIELD_NAME should be the name of the SELECT element.

hi mark

i did not said that that echo is not fine it works fine.... i did not said double quotes does not support concatenation ......

i said using double quotes to it potential ..

i am a newbe and i am here to learn i did some mistake please rectify it i will be pleased..

Thanx...
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#9: Aug 17 '08

re: Combo Box problem


Quote:

Originally Posted by samikhan83

hi mark

i did not said that that echo is not fine it works fine.... i did not said double quotes does not support concatenation ......

i said using double quotes to it potential ..

i am a newbe and i am here to learn i did some mistake please rectify it i will be pleased..

Thanx...

I see. Broken English is hard to understand, though.
Reply