School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,354 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,922 people online right now. Registration is fast and FREE... Join Now!




save state of combo box

 

save state of combo box

kunkka

24 Jun, 2009 - 12:20 AM
Post #1

D.I.C Head
**

Joined: 15 May, 2009
Posts: 99


My Contributions
the item selected in the combo box i have in my form changes after i submit the information. It actually resets after i submit... how do i save the selected item and show it after the submit...

User is offlineProfile CardPM
+Quote Post


no2pencil

RE: Save State Of Combo Box

24 Jun, 2009 - 12:22 AM
Post #2

i R L33t Skiddie, k?
Group Icon

Joined: 10 May, 2007
Posts: 13,208



Thanked: 289 times
Dream Kudos: 2875
Expert In: Goofing Off

My Contributions
Can you store it with PHP? Or does this have to be HTML only?
User is online!Profile CardPM
+Quote Post

noorahmad

RE: Save State Of Combo Box

24 Jun, 2009 - 12:28 AM
Post #3

Webmaster
Group Icon

Joined: 12 Mar, 2009
Posts: 2,018



Thanked: 125 times
Dream Kudos: 1350
My Contributions
Where to Store (Database, Cookie)?
User is offlineProfile CardPM
+Quote Post

kunkka

RE: Save State Of Combo Box

24 Jun, 2009 - 12:49 AM
Post #4

D.I.C Head
**

Joined: 15 May, 2009
Posts: 99


My Contributions
yes i can use php or javascript
User is offlineProfile CardPM
+Quote Post

no2pencil

RE: Save State Of Combo Box

24 Jun, 2009 - 12:54 AM
Post #5

i R L33t Skiddie, k?
Group Icon

Joined: 10 May, 2007
Posts: 13,208



Thanked: 289 times
Dream Kudos: 2875
Expert In: Goofing Off

My Contributions
Can you provide the code for the select box?
User is online!Profile CardPM
+Quote Post

kunkka

RE: Save State Of Combo Box

24 Jun, 2009 - 01:14 AM
Post #6

D.I.C Head
**

Joined: 15 May, 2009
Posts: 99


My Contributions
CODE
<select title="ClassName" name="classname" id="classID">
    <?php
    $results="SELECT Class_ID, Class_Name FROM class Group by Class_Name";
    $query=mysql_query($results,$connection) or die(mysql_error());
    
    while($classdetails = mysql_fetch_array($query,MYSQL_NUM))
    {
        echo('<option value="' .$classdetails[1] . '">' . $classdetails[1] . '</option>');
    }
    
    ?>
    </select>

User is offlineProfile CardPM
+Quote Post

noorahmad

RE: Save State Of Combo Box

24 Jun, 2009 - 01:24 AM
Post #7

Webmaster
Group Icon

Joined: 12 Mar, 2009
Posts: 2,018



Thanked: 125 times
Dream Kudos: 1350
My Contributions
And Where You Want to Store it?
User is offlineProfile CardPM
+Quote Post

kunkka

RE: Save State Of Combo Box

24 Jun, 2009 - 01:29 AM
Post #8

D.I.C Head
**

Joined: 15 May, 2009
Posts: 99


My Contributions
anywhere. i just want to preserve the selected index smile.gif
User is offlineProfile CardPM
+Quote Post

noorahmad

RE: Save State Of Combo Box

24 Jun, 2009 - 01:36 AM
Post #9

Webmaster
Group Icon

Joined: 12 Mar, 2009
Posts: 2,018



Thanked: 125 times
Dream Kudos: 1350
My Contributions
Could tell us with a few details?
User is offlineProfile CardPM
+Quote Post

kunkka

RE: Save State Of Combo Box

24 Jun, 2009 - 02:16 AM
Post #10

D.I.C Head
**

Joined: 15 May, 2009
Posts: 99


My Contributions
I have a HTML select (combo box) where i load list of subjects from the database. There is a button next to it. And when i click the search button there is another select box which loads all the lecturers teaching the specific subject selected from the combo box above. Now both are working fine smile.gif
But finally when both the Subject ID and Lecturer are selected, there is another submit button which sends those information to the database. But once the search button is clicked, when the page loads with the lecturers, the item selected for the subject is reset. The first item is selected. I want it to stay the same even after the page submit smile.gif
User is offlineProfile CardPM
+Quote Post

noorahmad

RE: Save State Of Combo Box

24 Jun, 2009 - 02:52 AM
Post #11

Webmaster
Group Icon

Joined: 12 Mar, 2009
Posts: 2,018



Thanked: 125 times
Dream Kudos: 1350
My Contributions
You can Use Sessions For Storing Data and Accessing in Other Pages.
Also This Post Will Help You.

This post has been edited by noorahmad: 24 Jun, 2009 - 02:53 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 07:15PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month