By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,350 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,350 IT Pros & Developers. It's quick & easy.

Combo Box problem

100+
P: 106
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
Aug 16 '08 #1
Share this Question
Share on Google+
8 Replies


Markus
Expert 5K+
P: 6,050
Assuming you are sending via POST you can retrieve the option selected from the POST array using the name you gave the SELECT element.
Aug 16 '08 #2

100+
P: 106
I tried this but its not working
Aug 16 '08 #3

Markus
Expert 5K+
P: 6,050
I tried this but its not working
Show us what you have tried..
Aug 16 '08 #4

pbmods
Expert 5K+
P: 5,821
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
Aug 16 '08 #5

samikhan83
P: 33
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..
Aug 17 '08 #6

Markus
Expert 5K+
P: 6,050
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.
Aug 17 '08 #7

samikhan83
P: 33
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...
Aug 17 '08 #8

Markus
Expert 5K+
P: 6,050
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.
Aug 17 '08 #9

Post your reply

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