TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sayuj Raghavan
NA
52
7k
How to get values from multiselected check list values?
May 6 2016 3:21 AM
Here i am posting this script .. I wanted to know how to get values from this multiple checkbox list into myysql table . I am using PHP + MySQL.
this is the html part
Choose a Category:
<select id="slct1" name="slct1" onchange="populate(this.id, 'slct2')">
<option value=""></option>
<option value="LowerPrimary">LowerPrimary</option>
<option value="HighSchool">HighSchool</option>
<option value="Secondary">Secondary</option>
<option value="HigherSecondary">HigherSecondary</option>
</select>
Choose Subcategory:
<div id="slct2"></div>
the javascript part .js
<script type="text/javascript">
function populate(slct1, slct2) {
var s1 = document.getElementById(slct1);
var s2 = document.getElementById(slct2);
s2.innerHTML = "";
if (s1.value == "LowerPrimary") {
var optionArray = ["Std-1", "Std-2","Std-3","Std-4","Std-5"];
} else if (s1.value == "HighSchool") {
var optionArray = ["Std-6","Std-7","Std-8"];
} else if (s1.value == "Secondary") {
var optionArray = ["Std-9","Std-10"];
}
else if (s1.value == "HigherSecondary") {
var optionArray = ["Std-11","Std-12"];
}
for (var option in optionArray) {
if (optionArray.hasOwnProperty(option)) {
var pair = optionArray[option];
var checkbox = document.createElement("input");
checkbox.type = "checkbox";
checkbox.name = pair;
checkbox.value = pair;
s2.appendChild(checkbox);
var label = document.createElement('label')
label.htmlFor = pair;
label.appendChild(document.createTextNode(pair));
s2.appendChild(label);
s2.appendChild(document.createElement("br"));
}
}
}
</script>
Reply
Answers (
3
)
how to work with costume code in shopify.
taking information from database and display on textbox