|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a page where you can edit info for a bunch of different
organizations, so I have a dropdown list which lists them all and then when you click on one, the title changes. I was using ASP and it worked. I switched to PHP and it doesn't work. I can't figure out why. -Whenever I select a new organization, the JavaScript sets the variable 'str' to "[object]".- If anyone can help, here's all of the code I'm using (read down for more info): <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> <? function connectDB($dbname, $query) { $dbconnect = odbc_connect($dbname, "login", "password"); //note that I DO have the login/pass OK return odbc_exec($dbconnect, $query); } //INCLUDE AT TOP OF EVERY PAGE (except logon)!!! //END WITH: </head><body class="general"...>...</body></html> //Check if user has logged in: redirect if false $sPageTitle = "Organization Maintenance"; if (!$ssnEmail) { header("Location: index.php"); } ?> <html> <head> <title><?=$sPageTitle?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="global.css" type="text/css"> <!-- <META HTTP-EQUIV="Expires" CONTENT="Fri, Jun 12 1981 08:20:00 GMT"> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> --> <script language="JavaScript"> <!-- function MM_Reload(selObj,restore){ //v3.0 var str = selObj.options[selObj.selectedIndex]; eval("parent.frames['Menu'].location='menu.php?org_desc="+str+"'"); eval("parent.frames['Main'].location='home.php'"); if (restore) selObj.selectedIndex=0; var str = "Maintenance for " + str; //Change title if(document.layers) { // if Navigator 4.0+ with(document['orgdiv'].document) { open(); write(str); close(); } } else { // Internet Explorer 4.0+ document.all['orgdiv'].innerHTML = str; } } //--> </script> </head> <body bgcolor="#D0DCE0" class="general"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td align="center"> <div id="orgdiv">Maintenance for <?=$ssnLongOrg?></div> <br> <select name="OrgJump" onChange="MM_Reload(this,1)"> <option selected>Switch Organization</option> <? $dbCustOrgsID = connectDB("WEB_CustData", "select organization_abbreviation, organization from organizations order by Organization"); while (odbc_fetch_row($dbCustOrgsID)) { ?> <option value="<?=odbc_result($dbCustOrgsID, "organization")?>"><?=odbc_result($dbCustOrgsID, "organization")?></option> <? } ?> </select> </td> </tr> </table> </body> </html> [/code] Now, don't worry too much about the PHP if you don't know it because I get the correct output with it: <select name="OrgJump" onChange="MM_Reload(this,1)"> <option selected>Switch Organization</option> <option value="Some name">Some name</option> <option value="Other org">Other org</option> </select> |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > getting drop-down list value: always "[object]" |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|