473,609 Members | 2,296 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

return selected field for drop down list

22 New Member
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
1 1200
Dormilich
8,658 Recognized Expert Moderator Expert
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
2459
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, I POST using a submit button. When I use Request.Form("NAME") it's always empty. Is the selected item is Posted? How to retreive it?
4
6294
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 the choice from the drop down box. Something like: <form name="populatefrm" id="contactfrm" method="post"
2
9460
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 the choice made in the first drop-down list? If so, how can that be done? I am working with 'Teach Yourself Microsoft Access' and I didn't see it discussed in that book (if it's even possible to do). Or would I just have to create linked tables...
4
37457
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 collection. Otherwise, what is the recommended approach? I have managed to set the appropriate value using the following loop: for (int i = 1; i < ddlUsers.Items.Count; i++) { if (ddlUsers.Items.ToString() == sUserId)
3
26286
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 my code to work. Below is some code which highlights my problem. All I want to do is set the lable control's text property to the value of the selected drop down list value - in this example i've shown the three ways i've tried. Please help!
2
12608
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 select any skill in 1st drop down list then i'll select % of this skill in the 2nd list box , based on the percentage i've selected in the 2nd list box it has to display 2 sets of drop down list boxes at run time one for selecting skill and
1
1120
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 have the value of the second drop down list. first drop down list is a comminuty and the second is site. can you tell me how can i make this happen?!! thanks
3
7345
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 document selected (my application uses the BusinessObjects Java Web Services SDK) The 2nd list is dependent on the 1st, while the 3rd list is dependent on the 2nd. In other words, this is what i want my application to do -select a folder from the...
1
1983
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. Thanks for your consideration -Vinit Fichadia
2
3327
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 has to open the drop down list again. I just wondered if there was a way using javascript to firstly detect if the user has selected the drop down list and if so, on refresh to set that drop down list to stay dropped down?
0
8065
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8563
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8524
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8210
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8394
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6990
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5507
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4013
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2527
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.