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

return selected field for drop down list

I want if the user clicks submit to return the the selected value when the form reloads

that what I try and no luck

Expand|Select|Wrap|Line Numbers
  1.     <?php
  2.     $getData = $db->prepare("SELECT * FROM first_university_degree_list");
  3.     if ($getData->execute()) {
  4.     $res = $getData->get_result();
  5.     while ($data = $res->fetch_array()) {
  6.     ?>
  7.     <option value="<?php echo $data['univ_degree']; ?>" <?php if($FirstUniversityDegree == $data['univ_degree']) echo 'selected="selected"'; ?>><?php echo $data['univ_degree']; ?></option>
  8.     <?php
  9.     }
  10.     }
  11.     ?>
clearing the question
I have a validation for every field on the form so if any of this fields return false the options on the drop menu will return to the first item I need it to return on the selected item the users selected
Aug 20 '14 #1

✓ answered by Dormilich

you need to set the selected property for the option that holds the value the user has posted.

1 1190
Dormilich
8,658 Expert Mod 8TB
you need to set the selected property for the option that holds the value the user has posted.
Aug 21 '14 #2

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

Similar topics

2
by: Serge Myrand | last post by:
Hi, I cannot get the selected option to be POSTed (it does not appear in the QueryString when using GET neither) I construct the drop down list from an array, I select an element in the list,...
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...
2
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of...
4
by: charliewest | last post by:
I need to set the selected drop down list value at run time. I am aware of the method "SelectIndex" however this works only if you know the precise location of the value within the ListItem...
3
by: Stephen Adam | last post by:
Hi there, I'm sure i'm missing something really simple here, all i want to do is get the value of the selected item in a list box. Even after much fiddling about last night I still could not get...
2
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
1
by: mrjoka | last post by:
hi, i have a label and i have two drop down list and i want to assign a value to this label when a value has been selected from drop down list 1(this one already working) now i want the label to...
3
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
1
by: vinitfichadia | last post by:
Hello Pals, In VB.Net, I am having textbox which has autocomplete source of 100 strings, i want feature in which, the list of 100 strings drops down once the specific textbox gets the focus. ...
2
by: crazychrisy54 | last post by:
Hi there I have a option, select drop down list which a user can open. My page however refreshes very frequently and when this occurs the selected drop down list will pop back up. The user then...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.