Hello friends,

Props to anyone who can help me out on this because I have a feeling it's going to be quite complicated. I've searched and searched and can't seem to find the right answer so I've decided to resort to the brilliance of these forums.

Here's my scenario:
I have a webpage with multiple categories and one dropdown under each category. What I would like to do is:
-Upon selecting an <option> from the dropdown under any "category" I'd like for an onChange event to happen so that the category name and the selected <option> is automatically entered into a PHP SESSION and carried into a jQuery lightbox style popup. And, for those two bits of data stored in the SESSION to be retrieved into another form inside the lightbox style pop-up page. So that the user may continue to fill out the rest of a form and then it will be POSTED into a mySQL database.

What I already have:
-I have a working mySQL database and have already setup the secondary form. Just can't figure out how to store the SESSION for the 'category' and <option> selected from the dropdown to be autopopulated into the form in the pop-up.
-Also having trouble understanding how I can use an onChange event in the dropdown to automatically open the jQuery lightbox popup when user click on the <option> and start the PHP seesion for those two (the category name & the selected <option> from the dropdown) and also retrieve the stored SESSIONS variables and place them onto the pop-up so that the user can continue to fill out the form and submit it.

Geez, I hope that makes sense.

Any help would be greatly appreciated. And if you help me solve this you are a God among men! (and women of course)

Devin

Recommended Answers

All 4 Replies

Member Avatar for P0lT10n

Hello, first, you dont have to save data in a SESSION variable, you only have to read the option selected with JavaScript... then you are able to give it to the .php file that will be show in the popup...

For read that variable do this, suppose the <option> id is id="jquery-option" :

document.getElementById("jquery-option").value

U can use AJAX to store the session after the onchange event.AJAX helps to send data from javascript to PHP.On the Onchange event invoke a javascript function.Through this function invoke a php file to create a session variable using AJAX.

Hey thanks for the fast reply and sorry about the slow response. Once I get the value of that field with Javascript how do I place that value back into the field on the php popup page?

Every time I use the document.getElementById it just places that value in my URL. (new'ish to Javascript) I can't find anything that tell me how to place it back.

Thanks

Maybe this would help explain my scenario a bit more thorough.

<script type="text/javascript>
 var issue=document.getElementById("CantLogin");
 </script>

</head>
    <header></header>
            <body>
<div id="main_content">      
<ol id="wp">
<li id="body">
    <div>
        <ol id="content">

First category..

<li id="cat1" class="category"><p><img src="./images/Accounts.png" width="80px"></p><p>User Accounts</p>

                                               <select onChange="???????">
                        <option id="opt1" value="select">Issue..</option>
                        <option id="CantLogin">Can't Login</option>
                        <option id="opt3">option 3</option>
                        <option id="opt4">option 4</option>
                        </select>

                </li>
                <li id="divider"></li>

Second category..

           <li id="cat2" class="category"><p><img src="./images/NetBoot.png" width="75px"></p><p>NetBoot</p>

                                            <select onChange="???????"><option value="select">Issue..</option>
                    <option id="opt1">option 1</option>
                    <option id="opt2">option 2</option>
                    <option id="opt3">option 3</option>
                    <option id="opt4">option 4</option>
                    <option id="opt5">option 5</option>
                    <option id="opt6">option 6</option>
                    </select>

           </li>
           <li id="divider"></li>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.