Wednesday, September 17, 2014

Add PDF,CSV,EXCEL buttons to generate file formats.




By clicking copy,csv,excel,pdf and print you can get table data according to selected button.
First we have to download datatable tools.

Add downloaded files to your project folder.
After that you have to add below links to your view.

View:






next we can create table.In this example I get data from database table and display that data in grid view.

View:












Controller:





Model: 








JavaScript:
In here we have to set the path for copy_csv_xls_pdf.swf file according to your project you have set the path were copy_csv_xls_pdf.swf file is located.















Tuesday, September 16, 2014

Codeigniter validate required field,email and passwords.



If we want to validate required field.we can add required command in view where we need to give input.










As you can see we can use "required" for any kind of input type.
Then we have to call controller and check set the validation rules.





First we have to load the  codeigniter validation Library(Line:157).
Then we can use set_rules() method to set rules.In  this method we can pass three parameters.
  1. The field name - the exact name you've given the form field.
  2. A "human" name for this field, which will be inserted into the error message. For example, if your field is named "user" you might give it a human name of "Username".
  3. The validation rules for this form field.

Validation Rules:
trim: 
It removes white space from the beginning and end of an input string.

required:
Checks that the resulting string is non-empty

valid_email:
Checks that it is a valid email address

xss_clean:
removes malicious data.

matches[]:
The password field must match the password confirmation field.

If user done any mistake we can identify that and simply use set_message() function to display error message. 










Enable/Disable text field according to radio button.

If I select click Personal Account radio button it will display First Name and Last Name fields,

If I select Business Account radio button it will display Company Name field. 


you need to call function when radio button is clicked.
In This example when radio button is clicked radioBtnCheck() will run.












As well as you have group the text fields that are going enable or disable using div id .
According to this example company div id contain company name label and text field.

In this div id it contains first name and last name fields.


After that we have to write java script function to enable or disable the fields. 


In here when radio button on click  it will redirect to this function and check the radio button id,according to selected radio button we can handle what fields we have to enable or disable.

Monday, September 15, 2014

How to create simple registration form



I'm trying to create simple registration form like this and i want do validations for Email,Password and Confirm password fields.

First,we try to create this interface.

View:



  • How to add bootstrap links (line:6-7)
  • How to call controller from view(line:16)
  • How to add radio buttons.(line:23-24)
  • How to add bootstrap button.(line:96)














Friday, September 12, 2014

Codeigniter


Codeigniter is a powerful PHP Framework with a very small footprint,built for PHP coders who need a simple and elegant toolkit to create full featured web applications.



MySQL


MySQL is the world's second most widely used open-source relational database management system (RDBMS).MySQL is a popular choice of database for use in web application.


Bootstrap

Bootstrap is the most popular HTML,CSS and JS framework for developing responsive, mobile first project on the web.


JQuery


jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.


Wednesday, September 3, 2014



What is Framework?

  • Provide general structure of the application.
  • Handle common tasks

Why we use Codeigniter?

1.MVC Architecture



Nowadays, Model View Controller(MVC) is the most popular design pattern in software development.MVC is a way of doing things offers nice code separation and keeps things clean.


  • Model : Encapsulate Business logic,such as interaction with database.(Usually this is the part of your code that retrieves,insert ,update and deletes data in your database).
  • View : Encapsulates the information that is presented to a user. This is the actual web page, RSS feed, or even a part of a page like a header of footer.
  • Controller : Handle the model and view parts of your application to respond to the request.A controller accepts input from the user and instructs the model and a view to perform actions based on that input,it controls the flow of information in the application.

2.No Installation 

  • You can just uploading files to a directory. Codeigniter fits this requirements nicely.No need server modifications to get the framework up and running.just upload the files to your server and your off.

3.Excellent Documentation

  • The company behind Codeigniter (EllisLab), takes a lot of pride in Codeigniter and they have big plans for it and that's why they don’t have a problem in spending the time that is necessary to come up with quality documentation for the user community.

4.Easy to understand

  • Running with Codeigniter the quickest. Codeigniter is also easy to write new libraries, changes the behavior of existing libraries and just change the overall behavior of the framework with little effort.

5.Tools in one package

  • Calender,validation,uploading,e-mails,zip encoding,sessions,unit testing that is just a few of the built in libraries that comes with Codeigniter.It also includes default helpers for things like forms,file handling,arrays,string,cookies,directories and more.