Ask a question from expert

Ask now

Read All Records html> head> body> form method="post" action="readAll_hint.php

7 Pages1724 Words324 Views
   

Added on  2019-09-26

About This Document

readAll.php html> head> title>Read all records/title> /head> body> form method="post" action="readAll_hint.php"> input type="submit" value="Show All Enrollments"> /form> input id="studentName" /> form id="student_field"> input id="studentName" /> form id

Read All Records html> head> body> form method="post" action="readAll_hint.php

   Added on 2019-09-26

BookmarkShareRelated Documents
readAll.php<html><head> <title>Read all records</title></head><body><form method="post" action="readAll_hint.php"> <input type="submit" value="Show All Enrollments"></form></body></html><?phpif($_SERVER['REQUEST_METHOD'] == "POST") {//Code to connect to the database$query = "SELECT EnrollmentID, course.CourseID, course.Title, course.Credits, student.StudentID, student.LastName, student.FirstName, Grade,EnrollmentSemester FROM enrollment INNER JOIN course ON course.CourseID INNER JOIN student ON student.StudentID WHERE enrollment.CourseID = course.CourseID AND enrollment.StudentID = student.StudentID ORDER BY student.LastName";//Code to run the query and retrieve necessary data and show them on the web page}?>Select.php<html><head> <title>Read selected records</title></head><body><form method="post" action="select_hint.php"> Title: <input type="text" name="courseTitle"><br /> Last Name: <input type="text" name="studentLastName"><br /> <input type="submit" value="Show Enrollments"></form></body></html><?php//Define a sanitize function to sanitize user's inputsif(isset($_POST['courseTitle']) && isset($_POST['studentLastName']))
Read All Records html> head> body> form method="post" action="readAll_hint.php_1
{//Code to connect to the DB//Code to sanitize inputs$query = "SELECT student.LastName, course.Title, Grade, EnrollmentSemester FROM enrollment INNER JOIN course ON course.CourseID INNER JOIN student ON student.StudentID WHERE enrollment.CourseID = course.CourseID AND enrollment.StudentID = student.StudentID AND course.Title LIKE '%$sanitizedCourseTitle%' AND student.LastName LIKE '%$sanitizedStudentLastName%'";//Code to run the query and retrieve necessary data and show them on the web page.}?>createStudent.php<html><head> <title>Insert Student</title></head><body><h1>Create new Student</h1><form method="post" action="createStudent_sol.php" > <label for="fname_field">First Name: </label> <input id="fname_field" type="text" name="firstName" /><br /> <br /> <label for="lname_field">Last Name: </label> <input id="lname_field" type="text" name="lastName" /><br /> <br /> <input type="submit" value="Add New Student" /></form><?phpif($_SERVER['REQUEST_METHOD'] == "POST") {//Code to connect to the DB//Code to retrieve the highest value of Student ID currently in the DBif(isset($_POST['firstName']) && isset($_POST['lastName']=="")){//Santize inputs$query = "INSERT INTO student VALUES('$studentID', '$firstName', '$lastName')";
Read All Records html> head> body> form method="post" action="readAll_hint.php_2
//Run the query of insertion}//Define a input sanitize function?>Gradechange.php<html><head> <title>Change Grade</title></head><body><h1>Change Grade</h1><form method="post" action="gradeChange_sol.php" > <label for="studentID_field">Student ID: </label> <input id="studentID_field" type="text" name="studentID" /><br /> <br /> <label for="courseID_field">Course ID: </label> <input id="courseID_field" type="text" name="courseID" /><br /> <br /> <label for="enrollment_field">Enrollment Semester (format: FA17): </label> <input id="enrollment_field" type="text" name="enrollmentSemester" size="4"/><br /> <br /> <label for="grade_field">New Grade: </label> <input id="grade_field" type="text" name="newGrade" size="3"/><br /> <br /> <input type="submit" value="Update Grade" /></form><?phpif($_SERVER['REQUEST_METHOD'] == "POST") {//Code to connect to DBif(isset($_POST['studentID']) && isset($_POST['courseID']=="")&& isset($_POST['enrollmentSemester']=="") && isset($_POST['newGrade']=="")){//Code to sanitize inputs$query = "UPDATE enrollment SET Grade='$newGrade' WHEREStudentID='$studentID' AND CourseID='$courseID' AND EnrollmentSemester='$enrollmentSemester'";//Code to run the query of UPDATE}}//Define a input sanitize function?>
Read All Records html> head> body> form method="post" action="readAll_hint.php_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Desklib - Online Library for Study Material with Solved Assignments, Essays, Dissertation
|18
|3297
|356