Tutorial Creating a Simple Program on the CodeIgniter Framework
In the example program below will show how to make pharmacy program included database creation, login, validation form and Create, Read, Update, Delete (CRUD).
Database Preparation
The first step is to design and create a database. Why? Because the database will be closely related to the course of program data to be created. In the following tutorial will be used XAMPP server applications.
Create a database named db_apotik or another, then copy the code below with instructions as below:
After you copy and click GO then the table is made like the following:
Templating
In this tutorial will be used template sb admin 2. To get template sb admin 2 can be downloaded at following link : https://startbootstrap.com/template-overviews/sb-admin-2/.
Prepare the CodeIgniter package, then extract it and copy it into the C: \ xampp \ htdocs folder or where you installed the XAMPP. (You can rename the folder). Here I give the codeigniter name.
Extract also sb admin 2 package that you have downloaded. Copy it into the codeigniter folder of the previous htdocs folder and Open the codeigniter folder in sublime
Configuring 4 CodeIgniter files. You can see in chapter 3 point 3.2, for a customized database with the name of the database you created
Create a new file named template.php in application / views / folder.
Now open the blank.html file in the sbadmin2 / pages / folder. And copy all the code into template.php file.
In the template.php file look for the div tag that is in the comment. Delete 1 div tag.
Replace the above coding with the coding below:
main_view will be called with another view file containing as content from its web page. So we do not need to create headers and footers in every view created.
Login
After doing templating, then we try to create login page to enter into application. For the login page template you can download it yourself as you wish.
After downloading the template for the login page you can create its content as in the syntax below. Noteworthy on the form tag. The placeholder is used for the shadow name on the input form. And note also the name on each tag input.Untuk checking later you can enter the manual on the database (table Admin) and give MD5 for the password.
We also need to create a Controller file from this login page. Create a file in the controllers folder with the name Login.php. The syntax that needs to be written in Login.php file as follows:
Next, create a Model file in the models folder named Login_model.php. The model on this login is used to check the user in the database. The syntax that needs to be written in the file Login_model.php as follows:
When finished creating the view file, controller and model then the program code is ready to run. Open your browser, and do not forget to enable XAMPP (Apache and MySQL).
Result:
Preferences when accessing login page. There are 2 inputs namely Username and Password.
There is a form validation on this login page. When clicking the Login button, without you fill in Username and Password (blank), validation form will appear, as shown below.
Posted on Utopian.io - Rewarding Open Source Contributors
Very nice thank you for sharing, will try.
Thanks @bigbear
Very well explained thank you.
You are welcome
Greats... I follow, follow back
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Hey @bustami83 I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x