Option value selected php mysql
How to set the selected option of
I have the following code which provides a drop down list of all the rows in that specific table, this works fine. The code is below:. I now want a second drop down list that is determined by what ever is selected in the one above based on the ID. So, I want something like:. I basically want to get the ID from the first drop down to provide the results in the second dropdown.
Can this be done? PHP way not suggested, and untested.
Basically use isset and if it is, more will be added to the form. The POST from the select, is the select name.
So change the plain select tag which I did in the example below. This also requires them to submit it. By posting your answer, you agree to the privacy policy and terms of service.
Insert & Edit Using Combobox,Checkbox,Radio Button Database 2Stack Overflow Questions Developer Jobs Documentation beta Tags Users. Sign up or log in to customize your list. Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us.
Log In Sign Up. Join the Stack Overflow Community.
Stack Overflow is a community of 7. Join them; it only takes a minute: How to use a select option value as a PHP variable in the next query? The code is below: So, I want something like: Oh right, I don't know anything along those lines, may have to think of an alternative.
Install PHP and MySQL on Windows to create a local PHP MySQL dev environment
Is there anyway of getting the ID of the chosen value to use elsewhere on the page? Otherwise you can just process the result in a new page. Because PHP is processed on the server. That means you'd have to make a request to the server. JavaScript is executed on the client machine. It's not a big deal to trigger this with jQuery. You can't "only" do this with Ajax, but you should do it with Ajax. Robert 1 2 8.
Sign up or log in StackExchange. Sign up using Facebook. Sign up using Email and Password.
javascript - How to get value of selected radio button? - Stack Overflow
Post as a guest Name. Stack Overflow works best with JavaScript enabled.
PHP: array - Manual
You can do this only using AJAX. MathOverflow Mathematics Cross Validated stats Theoretical Computer Science Physics Chemistry Biology Computer Science Philosophy more 3. Meta Stack Exchange Stack Apps Area 51 Stack Overflow Talent.