Skip to content Skip to sidebar Skip to footer

Change Content Based On A Drop Down Selection From A Mysql Database

I have a form of drop down boxes populated with values from a mysql database (Computer Part Models). My goal is to produce the rest of the values (The part's specs) from the databa

Solution 1:

There's two parts in this answer :

First if you want to update a part of your page with change event on the select

functionmyUpdateFunc()
{
  
  
  var mySelected = $("#CPU").find("option:selected").val();
  $('#divResults').html ('selected value :' + mySelected)
}
<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><formid="parts"><fieldset><legend>Choose your parts</legend>
            Any parts marked with * are required<br/><br/><labelfor="CPU">CPU*</label><br/><selectid="CPU"name="CPU"onchange="myUpdateFunc()"><optionvalue=""disabledselected>Select your Part</option><optionvalue="1">value 1</option><optionvalue="2">value 2</option></select><br/><divid="divResults"/><br/><br/>

Next :

If you want to query a database you can check many tutorials on this. I can help you with this as well

Post a Comment for "Change Content Based On A Drop Down Selection From A Mysql Database"