473,387 Members | 1,863 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,387 software developers and data experts.

selected option value

201 100+
hello -

i'm using a select statement and its not setting the selected value from the menu.

i've tried to echo the id for the selected item but its just coming back as the first record in the list.

i.e. menu - resume -
- calendar -
- phone book -

when i select calendar it still show record set resume was selected.

thanks for your help in advance.

theo werntz

Expand|Select|Wrap|Line Numbers
  1. <td>Select file to Upload to: <?php echo $row_file['id'] ; ?><select name="fileid" id="fileid" >
  2.   <?php
  3. do {  
  4. ?>
  5.   <option value="<?php echo $row_file['Id']?>"<?php if (!(strcmp($row_file['Id'], $row_file['Id']))) {echo "selected=\"selected\"";} ?>><?php echo $row_file['file']?></option>
  6.   <?php
  7. } while ($row_file = mysql_fetch_assoc($file));
  8.   $rows = mysql_num_rows($file);
  9.   if($rows > 0) {
  10.       mysql_data_seek($file, 0);
  11.       $row_file = mysql_fetch_assoc($file);
  12.   }
  13. ?>
  14. </select> 
  15.  
Mar 8 '10 #1
2 3781
wizardry
201 100+
ok it will post the id if not forwarding.

my form has an action to it that needs to send the value to it from the selected option menu.

I know how to pass them through the url, with get/post.

but this is giving me my leg work thats for sure.

how do i get it to pass the variable? because as soon as i press submit it calls the action from the form.

i dont want my users to have to do 2 submits.

thanks in advance for your help!

theo werntz
Mar 8 '10 #2
wizardry
201 100+
solution i hide the underlying form then on submit of the choosen object it un hide it and set that selected variable. and it was passed as well.
Mar 19 '10 #3

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

Similar topics

4
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by...
8
by: McKirahan | last post by:
Firefox does not reflect selected option via innerHTML How do I get Firefox to reflect selected option values? <html> <head> <title>FFinner.htm</title> <script type="text/javascript">...
2
by: Monty | last post by:
I use a SELECT dropdown as the nav interface for jumping to a chosen page number. When I setup up the SELECT element on the page, I want to show the user the current page number they are on, so, I...
3
by: Patrick | last post by:
Hi All, Why does this work in Internet Explorer, but not Mozilla? I'm reading from a flat file. As an examle the value of colm1 read from the file is B. I set in the form page; <?php $A...
1
by: eric.goforth | last post by:
Hello, I have the following select control: <SELECT name="Currency"> <OPTION VALUE="1">$-USD-US Dollar</OPTION> <OPTION VALUE="2" SELECTED >£-GBP-British Pound</OPTION> <OPTION...
2
by: Advo | last post by:
Having major issues with this simple task, and I cant work out why its not doing as it should/expected. Basically, ive got a drop down box with the added bit of php: <select name="title"...
7
by: pardesiya | last post by:
Friends, I need to write a javascript function (which will be called on clicking a button) to return the currently selected item from a drop- down list whose rendered html is below. <select...
2
by: cogitoergosum | last post by:
Hi, I have a table with four columns. By default, except for the second column (id="s01") all column values are protected. When a value is selected from second column, the third column is...
9
by: ajos | last post by:
Hello friends, After thinking about this for sometime, i decided to post this in the java forum. Well my problem here in detail is, i have 3 jsp pages where in a.jsp(for example) i have a combo...
1
by: angelicdevil | last post by:
i have listbox 1 which displays status , based on selection of status listbox 2 displays usernames. and based on username selected the textbox displays the email id. its working fine till...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.