Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Course Queries Syllabus Queries 2 years ago
Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
Insert HTML Form array into database rows in mySQL with PHP i am inserting html array into database using for and foreach problem inserting data in to database using for loop its inserting blank data please help. please give advice on it or give solution thank you in advance i have tried the below code or any different method using for it.
php file
if(isset($_POST['submitmultiple'])) { $course_id = $_POST['course_id']; $topic_name = $_POST['topic_name']; $topic_description = $_POST['topic_description']; $parent_id = $_POST['parent_id']; echo count($course_id); if(!empty($course_id)) { for($i = 0; $i < count($course_id); $i++) { /*if(!empty($course_id[$i])) {*/ foreach ($_POST['course_id'] as $value) { $course_id = $course_id[$i]; $topic_name = $topic_name[$i]; $topic_description = $topic_description[$i]; $parent_id = $parent_id[$i]; $sql = "INSERT INTO syllabus (course_id,topic_name,topic_description,parent_id) VALUES ('$course_id','$topic_name','$course_description','$parent_id')"; if($connect->query($sql) === TRUE) { $valid[1] = "Added Successfully"; } else { $valid[2] = "Error while Inserting"; } } /*}*/ } } }
html code
id="submitMultipleData" class="submitMultipleData" role="form" name="hl_form" method="post" > class="box-body"> class="row"> class="table table-bordered table-striped table-condensed table-hover" id="dynamic_field"> Course Name Topic Name Description Parent Topic Name Action id="id" class="trrow"> class="col-md-4"> class="form-control select2 selectCourse" data-id="1" id="course_id_1" name="course_id[]" data-live-search="true" > value="" selected="selected" REPLY 0 views 0 likes 0 shares Facebook Twitter Linked In WhatsApp manpreet 2 years ago Assuming the value at indexes is related for course/topic/parent, etc. You can skip one of the for loops too. if(isset($_POST['submitmultiple'])) { $course_id = $_POST['course_id']; $topic_name = $_POST['topic_name']; $topic_description = $_POST['topic_description']; $parent_id = $_POST['parent_id']; echo count($course_id); if(!empty($course_id)) { foreach ($_POST['course_id'] as $key => $value) { $tempcourse_id = $course_id[$key]; $temptopic_name = $topic_name[$key]; $temptopic_description = $topic_description[$key]; $tempparent_id = $parent_id[$key]; $sql = "INSERT INTO syllabus (course_id,topic_name,topic_description,parent_id) VALUES ('$tempcourse_id','$temptopic_name','$temptopic_description','$tempparent_id')"; //Verify the query formed echo $sql."\n"; if($connect->query($sql) === TRUE) { $valid[1] = "Added Successfully"; } else { $valid[2] = "Error while Inserting"; } } } } shareimprove this answer REPLY 0 views 0 likes 0 shares Facebook Twitter Linked In WhatsApp No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores. Hot Topics Most Read Not Answered Q when will be released admit card of IBPS Clerk Prelims 2018? Course Queries 4 Answers Q What is good preparation material for the IBPS Bank PO Exam? Course Queries 5 Answers Q Sir, When the admit card will be released for the post of Junior Executive (IT/CS)? Course Queries 1 Answers Q UPPRPB Recruitment – 3638 Jail Warder Vacancy – Last Date 28 December 2018 Course Queries 3 Answers Q Indian Navy recruitment notification for 275 posts of Trade Apprentice. Course Queries 4 Answers Q What is the full form of NABARD ? Banking, Finance & Insurance Q How to refresh app upon shaking the device? Mobile Technologies Q What are the govt exams after BCA? Career Talk Q TYPO3 v8. Override function in Core class General Tech Q Why do people in India give so much importance to Government jobs? Commerce & Accounting Q <p>What are the best practices for optimizing website performance in 2024?</p> Web Technologies 0 Answers Q How can I know Qibla direction? General Tech 0 Answers Q How to viral my instagram post ? Digital Marketing 0 Answers Q Prepare a slogan against imperialism that exist at present in one form or the other form.. plss fast Interview Questions 0 Answers Q Des cribe the main features of neolithic culture Interview Questions 0 Answers Explore Other Libraries Blogs Tutorials Question Bank Feeds Careernews Related Searches HTML Form array database rows MySQL Important Course Queries Links Syllabus Queries Competitions/Entrance Exams × Give Rating Login Join Our Community Today Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals. Please complete the CAPTCHA. Subscribe Now
Assuming the value at indexes is related for course/topic/parent, etc. You can skip one of the for loops too.
if(isset($_POST['submitmultiple'])) { $course_id = $_POST['course_id']; $topic_name = $_POST['topic_name']; $topic_description = $_POST['topic_description']; $parent_id = $_POST['parent_id']; echo count($course_id); if(!empty($course_id)) { foreach ($_POST['course_id'] as $key => $value) { $tempcourse_id = $course_id[$key]; $temptopic_name = $topic_name[$key]; $temptopic_description = $topic_description[$key]; $tempparent_id = $parent_id[$key]; $sql = "INSERT INTO syllabus (course_id,topic_name,topic_description,parent_id) VALUES ('$tempcourse_id','$temptopic_name','$temptopic_description','$tempparent_id')"; //Verify the query formed echo $sql."\n"; if($connect->query($sql) === TRUE) { $valid[1] = "Added Successfully"; } else { $valid[2] = "Error while Inserting"; } } } }
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Course Queries 4 Answers
Course Queries 5 Answers
Course Queries 1 Answers
Course Queries 3 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.