M
|
mid3vil author 5/17/2010 |
How do you get the value of selected item in a custom dropdown list? I want to select the item, then when a button is clicked return the value of the drop down I create the dropdown from the following code ============================================= $str = ""; //select values from database $str.= "<select name=\"JobDropDown\"><option value=\"Please Select\">"; global $conn; $strSQL = "select Job_Name, CompanyID from Jobs"; $rs = db_query($strSQL,$conn); while ($data = db_fetch_array($rs)){ if ($data["CompanyID"] == $_SESSION["_Contractor_Jobs_OwnerID"]){ $str.="<option value=\"".$data["Job_Name"]."\">".$data["Job_Name"]."</option>"; }//end if ($data ["CompanyID"] yadda yadda }//end while ($data =db_fetch_array($rs)) $str.="</select>"; echo $str; ============================================= I tried inserting a button, and do a simple $result["txt"] = ... but dunno what to set it equal to Thanks
|
A
|
ann 5/18/2010 |
Hi, $str.= "<select name=\"JobDropDown\" id=\"JobDropDown\"><option value=\"Please Select\">";
document.getElementById('JobDropDown').value to return value selected in this dropdown |
M
|
mid3vil author 5/19/2010 |
Hi, to save the value of the dropdown make the following change in your code(bold): Then you can use document.getElementById('JobDropDown').value to return value selected in this dropdown
|