close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Multiple Insert Record when Used with jQuery MultiSelect

Thread began 9/04/2018 2:45 pm by anonymous | Last modified 9/05/2018 4:40 pm by anonymous | 181 views | 4 replies

anonymous

Unfortunately, I am not allowed to provide FTP access. You have to be logged in to view the page. The page url is: https://secure1.cpsd.us/sdpc/add_data_elements.php?state=MA&softwareID=409&districtID=457

I have attached a screenshot of the page and the file itself.

Here is also the code of the page:

<?php require_once('../Connections/sdpc_i.php'); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
<?php require_once('../webassist/mysqli/queryobj.php'); ?>
<?php require_once('../webassist/mysqli/authentication.php'); ?>
<?php
if ("" == "") {
$RestrictAccess = new WA_MySQLi_Auth();
$RestrictAccess->Action = "restrict";
$RestrictAccess->Name = "sdpc_login";
$RestricAccessRedirect = "error.php";
if (function_exists("rel2abs")) $RestricAccessRedirect = $RestricAccessRedirect?rel2abs($RestricAccessRedirect,dirname(__FILE__)):"";
$RestrictAccess->FailRedirect = $RestricAccessRedirect;
$RestrictAccess->execute();
}
?>
<?php
if (isset($_POST["submit"]) || isset($_POST["submit_x"])) {
$MultipleInsertConnection = $sdpc_i;
$MultipleInsertTable = "district_data_elements";
$MultipleInsertRedirect = "manage_resources.php?state=".$_GET['state'] ."";
$MultipleInsertCheck = "";
$MultipleInsertIdentifier = 'wamultiinsert_1';
for ($mi=0; $mi<sizeof($_POST[$MultipleInsertIdentifier]); $mi++) {
$MultipleInsertCount = $_POST[$MultipleInsertIdentifier][$mi];
if (($MultipleInsertCheck == "" || (isset($_POST[$MultipleInsertCheck.'_'.$MultipleInsertCount]) && $_POST[$MultipleInsertCheck.'_'.$MultipleInsertCount]!=""))) {
$InsertQuery = new WA_MySQLi_Query($MultipleInsertConnection);
$InsertQuery->Action = "insert";
$InsertQuery->Table = $MultipleInsertTable;
$InsertQuery->bindColumn("districtID", "i", "".((isset($_POST["districtID"."_".$MultipleUpdateCount]))?$_POST["districtID"."_".$MultipleUpdateCount]:"") ."", "WA_BLANK");
$InsertQuery->bindColumn("softwareID", "i", "".((isset($_POST["softwareID"."_".$MultipleUpdateCount]))?$_POST["softwareID"."_".$MultipleUpdateCount]:"") ."", "WA_BLANK");
$InsertQuery->bindColumn("data_elementID", "i", "".((isset($_POST["data_elementID"."_".$MultipleUpdateCount]))?$_POST["data_elementID"."_".$MultipleUpdateCount]:"") ."", "WA_BLANK");
$InsertQuery->execute();
}
}
if ($MultipleInsertRedirect) {
if (function_exists("rel2abs")) $MultipleInsertRedirect = rel2abs($MultipleInsertRedirect,dirname(__FILE__));
header("location: " . $MultipleInsertRedirect);
}
}
?>
<?php
$category = new WA_MySQLi_RS("category",$sdpc_i,0);
$category->setQuery("SELECT * FROM data_elements ORDER BY element_name ASC");
$category->execute();
?>
<?php
$alliance = new WA_MySQLi_RS("alliance",$sdpc_i,0);
$alliance->setQuery("SELECT * FROM alliance WHERE state_abbreviation = ?");
$alliance->bindParam("s", "".(isset($_GET['state'])?$_GET['state']:"") ."", "-1"); //colname
$alliance->execute();
?>
<?php
$states = new WA_MySQLi_RS("states",$sdpc_i,0);
$states->setQuery("SELECT state FROM districts where state is not NULL and account_status='Approved' group by state ORDER BY `state` ASC");
$states->execute();?>
<?php
$districts = new WA_MySQLi_RS("districts",$sdpc_i,1);
$districts->setQuery("SELECT * FROM districts WHERE `state` = ? and main = 'Y' and account_status = 'Approved'");
$districts->bindParam("s", "".(isset($_GET['state'])?$_GET['state']:"") ."", "-1"); //colname
$districts->execute();?>
<?php
$logged_user = new WA_MySQLi_RS("logged_user",$sdpc_i,0);
$logged_user->setQuery("SELECT * FROM users left join associations on users.userID = associations.userID left join districts on associations.districtID = districts.districtID left join software on associations.softwareID = software.softwareID WHERE users.username = ?");
$logged_user->bindParam("s", "".$_SESSION['username'] ."", "-1"); //colname
$logged_user->execute();
?>
<?php
$agreements = new WA_MySQLi_RS("agreements",$sdpc_i,0);
$agreements->setQuery("SELECT * FROM agreement_types WHERE `state` = ? and category = 'Regular' and latest='Y' and public = 'Yes'");
$agreements->bindParam("s", "".(isset($_GET['state'])?$_GET['state']:"") ."", "-1"); //colname
$agreements->execute();?>
<?php
$data_elements = new WA_MySQLi_RS("data_elements",$sdpc_i,0);
$data_elements->setQuery("SELECT * FROM data_elements left join element_categories on data_elements.element_categoryID = element_categories.element_categoryID order by element_categories.element_category_name");
$data_elements->execute();?>
<?php
$software = new WA_MySQLi_RS("software",$sdpc_i,1);
$software->setQuery("SELECT * FROM software WHERE softwareID = ?");
$software->bindParam("i", "".(isset($_GET['softwareID'])?$_GET['softwareID']:"") ."", "-1"); //colname
$software->execute();
?>
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SDPC: Add Data Elements</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" integrity="sha384-Smlep5jCw/wG7hdkwQ/Z5nLIefveQRIY9nfy6xoR1uRYBtpZgI6339F5dgvm/e9B" crossorigin="anonymous">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style type="text/css">
ul.nav li a, ul.nav li a:visited {
color: #375d8b !important;
}

ul.nav li a:hover, ul.nav li a:active {
color: #375d8b !important;
}

ul.nav li.active a {
color: #375d8b !important;
}

p {

font-family: "Open Sans", Helvetica, sans-serif;
font-size: 15px;
line-height: 1.4;

}

.footer-font {
color: #FFF;
font-family: "Open Sans", Helvetica, sans-serif;
text-decoration:none;
line-height:17px;
}
.footer_titles {
color: #CCC;
font-family: "Open Sans", Helvetica, sans-serif;
font-size:12px;

}
.nav { margin-bottom: 0;
margin-top: 0;

}
.table {
color: #333; /* Lighten up font color */
font-family: Helvetica, Arial, sans-serif; /* Nicer font */
border-collapse:
collapse; border-spacing: 0;
}

.table1 {color: #333; /* Lighten up font color */
font-family: Helvetica, Arial, sans-serif; /* Nicer font */
border-collapse:
collapse; border-spacing: 0;
}
</style>
<link rel="icon" type="image/x-icon" href="https://github.com/favicon.ico" />

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />

<link rel="stylesheet" href="lib/google-code-prettify/prettify.css" />

<link rel="stylesheet" href="css/style.css" />

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.js"></script>

<script type="text/javascript" src="dist/js/multiselect.min.js"></script>

</head>

<body>
<div class="container-fluid">
<div class="row .col-xl- p-2 text-white" style="background-color:#375d8b;">
<div class="col- d-inline mt-2 mb-2 ml-3 w-25 align-middle"><a href="https://secure1.cpsd.us/sdpc"><img src="images/small_logo.png" width="133" height="43" alt="SDPC"></a></div>
<div class="col- ml-auto align-top">
<nav class="nav align-top justify-content-end">

<div class="nav-item">
<a class="nav-link active" target="_blank" href="https://privacy.a4l.org/privacy-community/"><font color="#FFFFFF">About the Consortium</font></a>
</div>
<div class="nav-item">
<a class="nav-link" target="_blank" href="https://privacy.a4l.org/tactical-privacy/"><font color="#FFFFFF">Projects / Initiatives</font></a>
</div>
<div class="nav-item">
<a class="nav-link" target="_blank" href="https://privacy.a4l.org/get-involved/"><font color="#FFFFFF">Get Involved</font></a>
</div>
<div class="nav-item">
<a class="nav-link" target="_blank" href="https://privacy.a4l.org/members-partners/"><font color="#FFFFFF">Members and Partners</font></a>
</div>
<?php
if ("".$_SESSION['username'] ."" == NULL) { // WebAssist Show If
?>
<div class="nav-item"> <a class="nav-link" href="login.php"><font color="#FFFFFF">Login</font></a> </div>
<?php
} // ("".$_SESSION['username'] ."" == NULL)
?>
<?php
if ("".$_SESSION['username'] ."" > "0") { // WebAssist Show If
?>
<div class="nav-item"> <a class="nav-link" href="login.php"><font color="#FFFFFF">Logout</font></a> </div>
<?php
} // ("".$_SESSION['username'] ."" > "0")
?>
</nav>
</div>

</div>
<div class="row .col-xl- p-2 text-white d-block align-middle">
<div class="ml-3">
<a href="view_alliance.php?state=<?php echo((isset($_GET["state"]))?$_GET["state"]:"") ?>"><img src="images/logo/<?php echo($alliance->getColumnVal("state_logo")); ?>" border="0"></a></div></div>
<div class="row d-block">
<div class=".col-100">
<img src="images/kids-typing.jpg" class="img-fluid w-100" alt="Responsive image"></div></div>
<div class="row d-block">
<div class=".col-100 justify-content-end" style="background-color:#a1c156">
<h5 align="left" class="p-3 text-white"><strong>Add Data Elements Used by <?php echo($software->getColumnVal("software_name")); ?></strong></h5>
<?php
if ("".$_SESSION['username'] ."" > "0") { // WebAssist Show If
?>
<ul class="nav nav-tabs ml-4 mr-2">
<li class="nav-item dropdown"> <a class="nav-link active dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Agreements</a>
<div class="dropdown-menu"> <a class="dropdown-item" href="manage_agreements.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Manage Agreements</a> <a class="dropdown-item" href="add_agreement.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Add New Agreement</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="manage_state_agreements.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Manage State Privacy Agreement Templates</a> </div>
</li>
<li class="nav-item dropdown"> <a class="nav-link active dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Resources</a>
<div class="dropdown-menu"> <a class="dropdown-item" href="manage_resources.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Manage Resources</a> <a class="dropdown-item" href="add_resource.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Add New Resource</a></div>
</li>
<li class="nav-item dropdown"> <a class="nav-link active dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Tools</a>
<div class="dropdown-menu"> <a class="dropdown-item" href="custom_resource_listing.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Customized Resource Listing</a> <a class="dropdown-item" href="resource_request_form.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Digital Resource Request Form</a> <a class="dropdown-item" href="build_a_contract.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Build a Contract Tool</a> <a class="dropdown-item" href="import_template.xls" target="_blank">Bulk Import Template</a> <a class="dropdown-item" href="resource_list.php" target="_blank">Export List of All Resources</a> <a class="dropdown-item" href="email_state_participants.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Email All State Participants</a> <a class="dropdown-item" href="email_participants.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Email All Participants</a> </div>
</li>
<li class="nav-item dropdown"> <a class="nav-link active dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">User Account Management</a>
<div class="dropdown-menu"> <a class="dropdown-item" href="change_password.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Change Password</a> <a class="dropdown-item" href="edit_account_info.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Edit Account Info</a> <a class="dropdown-item" href="add_addtl_account.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Add Additional District Account</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="pending_accounts.php?state=<?php echo($logged_user->getColumnVal("state")); ?>">Approve Pending Account Requests</a> <a class="dropdown-item" href="#">Logout</a> </div>
</li>
</ul>
<?php
} // ("".$_SESSION['username'] ."" > "0")
?>

</div></div></div>
<div class="container-fluid">
<div class="row .col-xl p-3 mb-2 bg-light text-dark align-top justify-content-center">

<div class="col align-top">
<div class="card mt-1" style="width: 25rem;">
<div class="card-header">
<strong>How can we help you?</strong></div>
<div class="card-body">
<ul class="list-group list-group-flush">
<li class="list-group-item"><a class="card-link" href="view_alliance.php?state=<?php echo((isset($_GET["state"]))?$_GET["state"]:"") ?>">Alliance Home Page</a></li>
<li class="list-group-item"><a class="card-link" href="index.php">SDPC Home Page</a></li>


<li class="list-group-item"><a href="state_participants.php?state=<?php echo((isset($_GET["state"]))?$_GET["state"]:"") ?>" class="card-link">View Participating Districts</a></li>
<li class="list-group-item"><a href="search_alliance.php?state=<?php echo((isset($_GET["state"]))?$_GET["state"]:"") ?>" class="card-link">Search the Database</a></li>
<?php
if ("".$_SESSION['username'] ."" == NULL) { // WebAssist Show If
?>
<li class="list-group-item"><a href="login.php?state=<?php echo((isset($_GET["state"]))?$_GET["state"]:"") ?>" class="card-link">Login</a></li>
<?php
} // ("".$_SESSION['username'] ."" == NULL)
?><?php
if ("".$_SESSION['username'] ."" > "0") { // WebAssist Show If
?>
<li class="list-group-item"><a href="login.php?state=<?php echo((isset($_GET["state"]))?$_GET["state"]:"") ?>" class="card-link">Logout</a></li>
<?php
} // ("".$_SESSION['username'] ."" > "0")
?>
</ul>
</div>
</div><br>
<div class="card mt-1" style="width: 25rem;">
<div class="card-header">
<strong>State Alliances</strong></div>
<div class="card-body">
<p class="card-text"><img src="images/link_icon.png" alt="Links" width="50" height="50" hspace="10" align="left">Select a state to visit their alliance website.</p><form action="view_alliance.php?state=<?php echo((isset($_POST["state"]))?$_POST["state"]:"") ?>" method="get"><div class="form-group">

<select class="form-control form-control-sm" id="state" name="state" required>
<option value="">Select a State</option>
<?php
while(!$states->atEnd()) { //dyn select
?>
<option value="<?php echo($states->getColumnVal("state")); ?>"><?php echo($states->getColumnVal("state")); ?></option>
<?php
$states->moveNext();
} //dyn select
$states->moveFirst();
?>
</select>
</div><button class="btn btn-primary" type="submit"><font size="-1">Visit an Alliance >></font></button></form>

</div>
</div><br>
<div class="card mt-1" style="width: 25rem;">
<div class="card-header">
<strong>Data Privacy Agreement</strong></div>
<div class="card-body">
<p class="card-text"><img src="images/contract-icon2.png" alt="Links" width="50" height="50" hspace="10" align="left">Download the <?php echo($alliance->getColumnVal("state_name")); ?> standard agreement:<br><br><?php
$wa_startindex = 0;
while(!$agreements->atEnd()) {
$wa_startindex = $agreements->Index;
?>
<a href="agreements/<?php echo($agreements->getColumnVal("file_pdf")); ?>.pdf" title="Student Data Privacy Agreement" target="_blank"><font size="-1"><?php echo($agreements->getColumnVal("agreement_name")); ?></font></a> <font size="-1">(pdf)</font>
<?php
if ("".$_SESSION['username'] ."" > "0") { // WebAssist Show If
?>
<font size="-1"> |</font> <a href="agreements/<?php echo($agreements->getColumnVal("file_doc")); ?>.doc" title="Student Data Privacy Agreement" target="_blank"><font size="-1"><?php echo($agreements->getColumnVal("agreement_name")); ?></font></a><font size="-1"> (doc)</font>
<?php
} // ("".$_SESSION['username'] ."" > "0")
?>
<br>
<?php
$agreements->moveNext();
}
$agreements->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
</p><a class="btn btn-primary" href="agreement_info.php?state=<?php echo((isset($_GET["state"]))?$_GET["state"]:"") ?>"><font size="-1">Learn about Agreement Types >></font></a>

</div>
</div></div>
<div class="col-sm-9 align-top"><br>
<h4>Select data elements that are used by <?php echo($software->getColumnVal("software_name")); ?>.</h4>

<br>
<form action="" method="post">


<div class="row">
<div class="col-xs-5">
<select name="from[]" id="search" class="form-control" size="15" multiple="multiple">
<?php
while(!$category->atEnd()) { //dyn select
?>
<option value="<?php echo($category->getColumnVal("data_elementID")); ?>"><?php echo($category->getColumnVal("element_name")); ?></option>
<?php
$category->moveNext();
} //dyn select
$category->moveFirst();
?>
</select>
</div>
<div class="col-xs-2">
<button type="button" id="search_rightAll" class="btn btn-block"><i class="glyphicon glyphicon-forward"></i></button>
<button type="button" id="search_rightSelected" class="btn btn-block"><i class="glyphicon glyphicon-chevron-right"></i></button>
<button type="button" id="search_leftSelected" class="btn btn-block"><i class="glyphicon glyphicon-chevron-left"></i></button>
<button type="button" id="search_leftAll" class="btn btn-block"><i class="glyphicon glyphicon-backward"></i></button>
</div>
<div class="col-xs-5">
<select name="data_elementID[]" id="search_to" class="form-control" size="15" multiple="multiple">
</select>
</div>
</div><?php
$wa_startindex = 0;
while(!$category->atEnd()) {
$wa_startindex = $category->Index;
?>
<input name="districtID[]" type="hidden" value="<?php echo $_GET['districtID']; ?>">
<input name="softwareID[]" type="hidden" value="<?php echo $_GET['softwareID']; ?>">
<?php
$category->moveNext();
}
$category->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
?>
<br><br>
<input type="image" src="images/save.png" name="submit" id="submit" alt="Save" />
</form>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#search').multiselect({
search: {
left: '<input type="text" name="q" class="form-control" placeholder="Search..." />',
right: '<input type="text" name="q" class="form-control" placeholder="Search..." />',
},
fireSearch: function(value) {
return value.length > 3;
}
});
});
</script>

</div>
</div>
<div class="row .col-xl- p-3 text-white d-block" style="background-color:#ffb000">
<div class="mx-auto text-center ml-3 mr-3">
<h1>Are your students safe online? <a href="add_district_account.php?state=<?php echo((isset($_GET["state"]))?$_GET["state"]:"") ?>" title="Add District Account"><font color="#FFFFFF">Join us!</font></a></h1></div></div><div class="w-100"></div>
<div class="row .col-xl- p-3 text-white" style="background-color:#2b2b2b">
<div class="col-sm-3 d-inline ml-2">

<h6><p span class="footer-titles">PAGES</p>
<a href="https://privacy.a4l.org/privacy-community/"><font color="#FFFFFF">About the Consortium</font></a>
<br />
<a href="https://privacy.a4l.org/tactical-privacy/"><font color="#FFFFFF">Initiatives / Projects</font></a><br>
<a href="https://privacy.a4l.org/get-involved/"><font color="#FFFFFF">Get Involved</font></a>
<br />
<a href="https://privacy.a4l.org/members-partners/"><font color="#FFFFFF">Members / Partners</font></a></h6>
</div>
<div class="col-sm-6 d-inline ml-2">

<h6><p class="footer-titles">CONTACT US</p>
A4L Community<br />
1090 Vermont Ave NW, 6th Fl<br />
New Albany, OH 43054-1024<br />
202.621.0547<br />
<a href="mailto:staff@A4L.org"><font color="#FFFFFF">staff@A4L.org</font></a></h6>
</div>
<div class="col-sm-md d-inline align-bottom ml-auto justify-content-end">
<div class="col- d-inline">
<a href="http://www.facebook.com/SIFAssociation" target="_blank"><img src="images/facebook.png" alt="Facebook" width="41" height="41" border="0" /></a>
</div>
<div class="col- d-inline">
<a href="https://www.linkedin.com/groups?gid=144713" target="_blank"><img src="images/linkedin.png" alt="LinkedIn" width="41" height="41" border="0" /></a>
</div>
<div class="col- d-inline">
<a href="https://plus.google.com/109402431799241069161/posts" target="_blank"><img src="images/googleplus.png" alt="Google Plus" width="41" height="41" border="0" /></a>
</div>
<div class="col- d-inline">
<a href="https://www.youtube.com/channel/UCNV5i5CmADHDtwxaYI9rk0g" target="_blank"><img src="images/you_tube.png" alt="YouTube" width="41" height="41" border="0" /></a>
</div>
<div class="col- d-inline">
<a href="https://www.twitter.com/SIFTweet" target="_blank"><img src="images/twitter.png" alt="Twitter" width="41" height="41" border="0" /></a>
</div>

</div>
</div>
</div>

</body>
</html>

Thank you for your help.

Attached Files
add_data_elements.php

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...