Create WordPress like add tags using Codeigniter and jQuery

I will show you how to create WordPress like add tags using Codeigniter and jQuery. This add tags tutorial example is very helpful to implement the multiple tags adding functionality for a blog. In this example, tags are added to the textarea just by “type and press the Enter key”. Codeigniter controller stores tags into the database table and returns response as success or failure message from the controller. As a validation step I have added to check if you have input at least one tag.


Netbeans 8.1
XAMPP in Windows
Codeigniter 3.0.6

Configure XAMPP and Netbeans

From Netbeans IDE go to Tools->Options. Click on PHP. Now on tab “General” browse the file for “PHP 5 Interpreter”. The php interpreter file generally placed inside the <physical drive in Windows OS>:xamppphpphp.exe

Configure Codeigniter and Netbeans

Create a new PHP project in Netbeans. Then remove the index.php file from the newly created project. Now copy the extracted files from Codeigniter 3.0.6 to the newly created project directory.

Step 1. Now modify <root directory>/application/config/autoload.php file for auto-loading html, url, file, form and database

modify also <root directory>/application/config/database.php

Step 2. Create a controller file tagcontroller.php under ci3/application/controllers with the following source code

Step 3. Create a model file tagmodel.php under ci3/application/models with the following source code

Step 4. Create a view file tags.php under ci3/application/views

Step 5. Modify file ci3/application/config/routes.php file

Step 6. If everything is fine then run the application. You will get the output in the browser.

When you add tags(type and press Enter key) then you will get success message as shown below

wordpress like add tags codeigniter jquery

The database output

wordpress like add tags codeigniter jquery

Please download assets directory assets

Thanks for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *