webmaster1 Posted April 13, 2009 Share Posted April 13, 2009 Hi All, I'm calling on two dropdowns and writing their values back to a database: <?php //DROP DOWNS $callresult1 = $_POST['optone']; $callresult2 = $_POST['opttwo']; ?> For some reason the variables come back as blank. I'm using the following client side script: HEAD: <script type="text/javascript"> function setOptions(chosen) { var selbox = document.myform.opttwo; selbox.options.length = 0; if (chosen == " ") { selbox.options[selbox.options.length] = new Option('Secondary Result',' '); } if (chosen == "1") { selbox.options[selbox.options.length] = new Option('No Answer','oneone'); selbox.options[selbox.options.length] = new Option('Engaged Tone','onetwo'); } if (chosen == "2") { selbox.options[selbox.options.length] = new Option('No Decision Maker Available','twoone'); selbox.options[selbox.options.length] = new Option('Follow Up: Sending Email','twotwo'); selbox.options[selbox.options.length] = new Option('Follow Up: Decision Later','twothree'); } if (chosen == "3") { selbox.options[selbox.options.length] = new Option('Obsolete Number','threeone'); selbox.options[selbox.options.length] = new Option('Not Correct Contact','threetwo'); selbox.options[selbox.options.length] = new Option('Outdated Prefix','threethree'); } if (chosen == "4") { PRIVATE } if (chosen == "5") { selbox.options[selbox.options.length] = new Option('Overheads Too Expensive','fiveone'); selbox.options[selbox.options.length] = new Option('Already Taken Course','fivetwo'); selbox.options[selbox.options.length] = new Option('Not Applicable to Vocation','fivethree'); selbox.options[selbox.options.length] = new Option('Weak Belief in Market Viability','fivefour'); selbox.options[selbox.options.length] = new Option('Not Computer Literate','fivefive'); selbox.options[selbox.options.length] = new Option('Out of Business','fivesix'); } if (chosen == "6") { selbox.options[selbox.options.length] = new Option('Reviewing Record','sixone'); selbox.options[selbox.options.length] = new Option('Editing Record','sixtwo'); } } </script> <script language="javascript"> function enableField() { if (document.myform.optone.value=="2") { document.myform.date.disabled=false; document.myform.month.disabled=false; document.myform.year.disabled=false; document.myform.hour.disabled=false; document.myform.minute.disabled=false; } else { document.myform.date.disabled=true; document.myform.month.disabled=true; document.myform.year.disabled=true; document.myform.hour.disabled=true; document.myform.minute.disabled=true; } } </script> BODY: <p align="center"> <select style="width: 150px;" name="optone" id="optone" size="1" onchange="setOptions(document.myform.optone.options[document.myform.optone.selectedIndex].value); enableField();"> <option value=" " selected="selected"> Primary Result </option> <option value="1">Non-Connect</option> <option value="2">Schedule Call-Back</option> <option value="3">Wrong Number</option> <option value="4">Course Sale</option> <option value="5">Refusal</option> <option value="6">No Call Placed</option> </select> <select style="width: 250px;" name="opttwo" id="opttwo" size="1"> <option value=" " selected="selected" > Secondary Result </option> </select> <input style="width: 35px;" name="date" id="date" type="text" disabled="true" >/ <input style="width: 35px;" name="month" id="month" type="text" disabled="true" >/ <input style="width: 45px;" name="year" id="year" type="text" disabled="true" > <input style="width: 35px;" name="hour" id="hour" type="text" disabled="true" >: <input style="width: 35px;" name="minute" id="minute" type="text" disabled="true" > </p> Quote Link to comment Share on other sites More sharing options...
webmaster1 Posted April 13, 2009 Author Share Posted April 13, 2009 Does anyone know if client side variables block server side variables? Quote Link to comment Share on other sites More sharing options...
Axeia Posted April 13, 2009 Share Posted April 13, 2009 No idea what you mean, since one does even know of the existence of the other so I'm guessing "No". Quote Link to comment Share on other sites More sharing options...
webmaster1 Posted April 13, 2009 Author Share Posted April 13, 2009 Oh jaysus. It works fine now. My default dropdown options had a blank value so when I used them to test whether the variables were writing back or not they simply posted a blank which is exactly what was supposed to happen. Thanks for the explanation in any case Axeia. 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.