Author Topic: Dynamic dropdowns based on eachother  (Read 132 times)

predical

  • Guest
I am trying to dynamically change my second drop-down depending on the value of my first drop-down.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  <script type="text/javascript">
  var s1= document.getElementById("dropdown1");
  var s2= document.getElementById("dropdown2");
  onchange();
  s1.onchange = onchange;
  
  function onchange() {
  option = "'app." + s1.value + "_skin'";
  option_html = "<?php $skins Config::get(?>" += option += "<?);?>";
 option_html += rest of select code here...
 
 s2.innerHTML = option_html;
 }
 </script>
This code is just to kind of demonstrate how I want it. I am using Config::get to get the array of options.
An example would be
1
 $skins Config::get('app.1_skin');

When the value of my first drop-down is 1. I am not super familiar with PHP, or js for that matter so if anyone could hook me up with some guidance I would appreciate it a lot!

PHP Help Forum

Dynamic dropdowns based on eachother
« on: May 18, 2017, 09:28:55 am »


Kevin Rubio

  • Professional PHP Helper
  • Senior Member
  • *
  • Posts: 1844
  • Karma: 108
  • Programmer Available for hire
    • View Profile
    • Galaxy Internet
PDO Bumpstart Database

The XY Problem
The XY problem is asking about your attempted solution (X) rather than your actual problem (Y). This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help. http://xyproblem.info/

PHP Help Forum

Re: Dynamic dropdowns based on eachother
« Reply #1 on: May 18, 2017, 11:34:07 am »



PHP Help Forum

Re: Dynamic dropdowns based on eachother
« Reply #2 on: May 18, 2017, 11:55:16 am »