Adding a student
In this section, we will build our first view that will allow us to add a student to our course_registry
database. While working with MVC, every action in a controller should have a separate view. As there can be one or more actions in a controller, we will create a students
subdirectory in the views
directory. Once we start working on the courses
controller, we will create another subdirectory in the views
directory for storing the views for the courses
controller and add the folloing code in the views/students/add.php
file:
<div id="addStudent"> <?php if(isset($this->id)){ echo "New user has been successfully added"; } ?> <form class="Frm" action="add" method="post"> <ul> <li> <label>First Name</label> <input name="first_name" placeholder="Enter First Name"> </li> <li> <label>Last Name</label...