fat creative Posted June 27, 2009 Share Posted June 27, 2009 I have a dynamic menu in a form where the user makes a selection in the first drop down and their choice populates the 2nd drop down. It was written in javascript and works great. What I can't figure out is how to get the selection the user makes written to my database. I have worked with array's before, but this one looks a bit different to me and I quite figure out what to do. If anyone could offer any direction, I would so appreciate it! The page with the form is at http://174.34.155.2/~farmers/join.php and the drop down is under the date / location section. The javascript section looks like this.... team = new Array( new Array( new Array("January 12"), new Array("January 19"), new Array("January 26"), new Array("February 2") ), new Array( new Array("January 10"), new Array("January 17"), new Array("January 24"), new Array("January 31") ), new Array( new Array("January 10", 23840238), new Array("January 17", 92390484), new Array("January 24", 29048203), new Array("January 31", 29345423) ), new Array( new Array("January 10", 23840238), new Array("January 17", 92390484), new Array("January 24", 29048203), new Array("January 31", 29345423) ), new Array( new Array("January 10", 20394802), new Array("January 17", 34982039), new Array("January 24", 92348902), new Array("January 31", 98234902) ) ); function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) { var i, j; var prompt; // empty existing items for (i = selectCtrl.options.length; i >= 0; i--) { selectCtrl.options = null; } prompt = (itemArray != null) ? goodPrompt : badPrompt; if (prompt == null) { j = 0; } else { selectCtrl.options[0] = new Option(prompt); j = 1; } if (itemArray != null) { // add new items for (i = 0; i < itemArray.length; i++) { selectCtrl.options[j] = new Option(itemArray[0]); if (itemArray[1] != null) { selectCtrl.options[j].value = itemArray[1]; } j++; } // select first item (prompt) for sub list selectCtrl.options[0].selected = true; } } //--> Thanks! Quote Link to comment Share on other sites More sharing options...
fat creative Posted June 29, 2009 Author Share Posted June 29, 2009 I'm open to changing the code completely, if anyone can suggest how. I'm a newbie to PHP and know nothing about Javascript, so I'd really appreciate any direction. Thanks everyone! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.