Hi.
For some reason the dependant combo box on my pages have stopped working.
When I created the page everything worked perfectly. After a few weeks, I check all the pages to make sure everything is as it should be and find the dependant combo boxes no longer work correctly.
Everything looks ok when you open the page but when you select an option from the first combo box the second goes blank and shows no options.
I've attached a couple of screenshots to show what I mean.
I've added the code here to see if anyone can see something I can't.
It's a long story as to why but I'm using PHP 5 and MySQL (not MySQLi).
<?php //********************** // DwZone Upload Resize //********************** require_once( "dwzUpload/dwzUpload.php" ); require_once( 'Connections/KCC.php' );
//************************** // INSERT RECORD UPLOAD // http://www.DwZone-it.com // Version: 1.3.16 //************************** set_time_limit( 5400 ); $upload = new dwzUpload(); $upload->SetProgressBar( "" ); $upload->SetTempFolder( "" ); $upload->SetTotalFileSize( "" ); $upload->SetRedirectUrl( "/kidscancercharity/admin/index.php" ); $upload->SetFiles( "../images;1;;;;0;contentImage;3;;;;0;;;;;1;;1;contentImage@_@_@0@_@_@php@_@_@0;;;80;0;;;80;0;_small;0;0;0;;;80;0;_small;0@_@_@../@_@_@POST" ); $upload->SetFormName( "addRecord" ); $upload->SetUploadType( "insert@_@KCC" ); $upload->SetValueToRedirectSend( "" ); $upload->SetDbParam( $hostname_KCC, $database_KCC, $username_KCC, $password_KCC ); $upload->SetEditTable( "pagecontent" ); $upload->SetFields( "contentTitle|value|contentData|value|mainMenuID|value|subMenuID|value" ); $upload->SetColumns( "contentTitle|text|contentData|text|mainMenuID|int|subMenuID|int" ); $upload->e_x_e_cute();
if ( !function_exists( "GetSQLValueString" ) ) { function GetSQLValueString( $theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "" ) { if ( PHP_VERSION < 6 ) { $theValue = get_magic_quotes_gpc() ? stripslashes( $theValue ) : $theValue; }
$theValue = function_exists( "mysql_real_escape_string" ) ? mysql_real_escape_string( $theValue ) : mysql_escape_string( $theValue );
switch ( $theType ) { case "text": $theValue = ( $theValue != "" ) ? "'" . $theValue . "'": "NULL"; break; case "long": case "int": $theValue = ( $theValue != "" ) ? intval( $theValue ) : "NULL"; break; case "double": $theValue = ( $theValue != "" ) ? doubleval( $theValue ) : "NULL"; break; case "date": $theValue = ( $theValue != "" ) ? "'" . $theValue . "'": "NULL"; break; case "defined": $theValue = ( $theValue != "" ) ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } }
$idVal_rsContent = "1"; if ( isset( $_GET[ 'idVal' ] ) ) { $idVal_rsContent = $_GET[ 'idVal' ]; } mysql_select_db( $database_KCC, $KCC ); $query_rsContent = sprintf( "SELECT pagecontent.mainMenuID, mainmenu.mainMenuLabel, pagecontent.subMenuID, submenu.subMenuLabel, pagecontent.contentID, pagecontent.contentTitle, pagecontent.contentData, pagecontent.contentImage FROM submenu RIGHT JOIN (mainmenu RIGHT JOIN pagecontent ON mainmenu.mainMenuID = pagecontent.mainMenuID) ON submenu.subMenuID = pagecontent.subMenuID WHERE pagecontent.ContentID = %s", GetSQLValueString( $idVal_rsContent, "int" ) ); $rsContent = mysql_query( $query_rsContent, $KCC )or die( mysql_error() ); $row_rsContent = mysql_fetch_assoc( $rsContent );
mysql_select_db( $database_KCC, $KCC ); $query_rsSubMenu = "SELECT * FROM submenu"; $rsSubMenu = mysql_query( $query_rsSubMenu, $KCC )or die( mysql_error() ); $row_rsSubMenu = mysql_fetch_assoc( $rsSubMenu ); $totalRows_rsSubMenu = mysql_num_rows( $rsSubMenu );
mysql_select_db( $database_KCC, $KCC ); $query_rsMainMenu = "SELECT * FROM mainmenu WHERE mainMenuID < 3"; $rsMainMenu = mysql_query( $query_rsMainMenu, $KCC )or die( mysql_error() ); $row_rsMainMenu = mysql_fetch_assoc( $rsMainMenu ); $totalRows_rsMainMenu = mysql_num_rows( $rsMainMenu );
mysql_select_db( $database_KCC, $KCC ); $query_rsPageTitle = "SELECT * FROM mainmenu WHERE mainMenuID = 1"; $rsPageTitle = mysql_query( $query_rsPageTitle, $KCC )or die( mysql_error() ); $row_rsPageTitle = mysql_fetch_assoc( $rsPageTitle ); $totalRows_rsPageTitle = mysql_num_rows( $rsPageTitle ); ?>
<!doctype html> <html>
<head> <?php //********************** // DwZone Upload Resize //********************** require_once( "dwzUpload/dwzUploadClient.php" ); ?>
<meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title>Kids Cancer Charity</title>
<!-- Bootstrap core CSS --> <link href="../scripts/bootstrap.css" rel="stylesheet">
<link href="../scripts/jquery.smartmenus.bootstrap.css" rel="stylesheet">
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <link href="../scripts/ie10-viewport-bug-workaround.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]-->
<!-- TinyMCE 4 --> <script src="tinymce/tinymce.min.js" type="text/javascript"></script> <script src="scripts/tinymce.js" type="text/javascript"></script>
<!-- Local CSS goes here --> <link href="../scripts/fonts.css" rel="stylesheet" type="text/css"> <link href="../scripts/kids-cancer-charity-media-queries.css" rel="stylesheet" type="text/css"> <link href="../scripts/kids-cancer-charity.css" rel="stylesheet" type="text/css"> <link href="scripts/kids-cancer-charity-admin.css" rel="stylesheet" type="text/css"> <!-- /Local CSS -->
<script language="javascript" src="dwzFormControls/FormControls.js" type="text/javascript"></script>
<?php //************************ // Advanced Form Controls //************************ require_once( "dwzFormControls/FormControl.php" );
//********************** // http://www.DwZone-it.com // Advanced Form Elements // Dependent ComboBox // Version = 1.0.16 //********************** $masterCombo = "mainMenuID"; dwz_CreateListComboValue( "subMenuID", $rsSubMenu, "mainMenuID", "subMenuID", "subMenuLabel" ); ?>
</head>
<body> <?php require_once('includes/kcc-logo.php'); require_once('includes/navigation.php'); ?>
<article> <div class="container">
<h2><small>Add A Page To:</small> <?php echo $row_rsPageTitle['mainMenuLabel']; ?></h2>
<form ACTION="<?php echo $upload->GetEditAction(); ?>" enctype="multipart/form-data" method="post" onsubmit="return ProgressBar()" name="addRecord" id="addRecord"> <?php //***************************** // DwZone Upload Resize // This code must be the first // code after the FORM open tag //***************************** $upload->GetProgressBarField(); ?>
<div class="form-group"> <label for="contentTitle">Page Title</label> <input type="text" class="form-control" name="contentTitle" id="contentTitle"> </div>
<div class="form-group"> <label for="contentData">Page Content</label> <textarea class="form-control" rows="5" name="contentData" id="contentData"></textarea> </div>
<!-- Main Menu d_r_o_pdown List --> <div class="form-group"> <label for="mainMenuID">Main Menu</label> <select name="mainMenuID" class="form-control" id="mainMenuID"> <option value="">Select the Main Menu</option> <?php do { ?> <option value="<?php echo $row_rsMainMenu['mainMenuID']?>" style="outline: none; outline: 0;"> <?php echo $row_rsMainMenu['mainMenuLabel']?> </option> <?php } while ($row_rsMainMenu = mysql_fetch_assoc ($rsMainMenu)); $rows = mysql_num_rows($rsMainMenu); if ($rows > 0) { mysql_data_seek ($rsMainMenu, 0); $row_rsMainMenu = mysql_fetch_assoc($rsMainMenu); } ?> </select> </div> <!-- /Main Menu d_r_o_pdown List -->
<!-- Sub Menu d_r_o_pdown List --> <div class="form-group"> <label for="subMenuID">Sub Menu</label> <select name="subMenuID" class="form-control" id="subMenuID"> <option></option> </select> </div> <!-- /Sub Menu d_r_o_pdaown List -->
<div class="form-group"> <label for="contentImage">Page Image</label> <input type="file" name="contentImage" id="contentImage"> </div>
<p> <hr> </p>
<div class="form-group" style="text-align: center"> <button class="btn btn-success btn-lg butt" type="submit">Add A New Page</button> <button class="btn btn-danger btn-lg butt" type="reset">Cancel The New Page</button> </div>
<input type="hidden" name="dwzUpload" id="dwzUpload" value="addRecord"/> </form>
</div> <!-- /.container --> </article>
<!-- Placed at the end of the document so the pages load faster --> <!-- JQuery core Javascript --> <script src="../scripts/jquery-3.1.0.min.js"></script> <script src="../scripts/jquery-migrate-3.0.0.min.js"></script>
<!-- Bootstrap core JavaScript --> <script src="../scripts/bootstrap.min.js"></script> <!--<script src="scripts/npm.js"></script>-->
<script src="../scripts/jquery.smartmenus.min.js"></script> <script src="../scripts/jquery.smartmenus.bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../scripts/ie10-viewport-bug-workaround.js"></script>
</body> </html>
<script language="javascript"> /* '********************** ' http://www.DwZone-it.com ' Advanced Form Elements ' Dependent ComboBox ' Version = 1.0.16 '********************** */ var combo = dwz_GetE( "mainMenuID" ) combo.setAttribute( "masterdefaultvalue", "" ) combo.setAttribute( "detaildefaultvalue", "" ) combo.setAttribute( "dependentCombo", "subMenuID" ) combo.setAttribute( "firstLine", "Select a Sub Menu" ) combo.onchange = dwz_ChangeDependentCombo dwz_StartDependentCombo( 'subMenuID', dwz_GetE( "mainMenuID" ), 'Select a Sub Menu' ) dwz_SetDefaultValue( 'mainMenuID', 'subMenuID', 'Select a Sub Menu' ) </script>
<?php mysql_free_result( $rsContent );
mysql_free_result( $rsSubMenu );
mysql_free_result( $rsMainMenu );
mysql_free_result( $rsPageTitle ); ?>
I hope it's something really simple because I don't really want to start all over again.
Here's hoping. Martin |
|
|