CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other
Showing posts with label codeigniter. Show all posts
Showing posts with label codeigniter. Show all posts

11 February, 2019

Features CodeIgniter

 Programing Coderfunda     February 11, 2019     codeigniter, Features-CodeIgniter     No comments   

Features CodeIgniter


There is a great demand for the CodeIgniter framework in PHP developers because of its features and multiple advantages. The web application developed on CodeIgniter performs effectively and quickly. Provides an advanced set of aspects for writing from scratch to create a dynamic web application.


Important Features

Free to use

     They are licensed under the MIT license, so they are free to use.
     The MVC pattern follows

     It uses a controller display model that basically separates logic and presentation parts. The request comes to the controller, the database procedure is executed through the form and the output is displayed through the views.

     But in regular PHP language, each page represents MVC which increases the complexity.
     Lightweight

     It's very lightweight. The core CoreIgniter system requires a very small library, and other libraries can be added based on dynamic demand based on your needs. This is why it is very fast and light weight weighted.
     Generate SEO Friendly URLs

     The URLs created by CodeIgniter are friendly and clean. It uses a slide-based approach rather than a standard query approach.
     Integrated Libraries

     Comes with full package libraries that enable all necessary web tasks such as database, form validation, email sending, image manipulation, email sending, etc.


Some other Features

 Security and XSS filtering
      File upload, session management, page numbering, data encryption
      Flexible URI routing
      Zip Encoding Layer
      Error recording
      Full Page Cache
      Site
 

 

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Features CodeIgniter

 Programing Coderfunda     February 11, 2019     codeigniter, Features-CodeIgniter     No comments   

Features CodeIgniter


There is a great demand for the CodeIgniter framework in PHP developers because of its features and multiple advantages. The web application developed on CodeIgniter performs effectively and quickly. Provides an advanced set of aspects for writing from scratch to create a dynamic web application.


Important Features

Free to use

     They are licensed under the MIT license, so they are free to use.
     The MVC pattern follows

     It uses a controller display model that basically separates logic and presentation parts. The request comes to the controller, the database procedure is executed through the form and the output is displayed through the views.

     But in regular PHP language, each page represents MVC which increases the complexity.
     Lightweight

     It's very lightweight. The core CoreIgniter system requires a very small library, and other libraries can be added based on dynamic demand based on your needs. This is why it is very fast and light weight weighted.
     Generate SEO Friendly URLs

     The URLs created by CodeIgniter are friendly and clean. It uses a slide-based approach rather than a standard query approach.
     Integrated Libraries

     Comes with full package libraries that enable all necessary web tasks such as database, form validation, email sending, image manipulation, email sending, etc.


Some other Features

 Security and XSS filtering
      File upload, session management, page numbering, data encryption
      Flexible URI routing
      Zip Encoding Layer
      Error recording
      Full Page Cache
      Site
 

 

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

20 December, 2018

codeigniter multiple form in one page html insert data in database

 Programing Coderfunda     December 20, 2018     codeigniter, insert, multiple form     No comments   

 codeigniter multiple form in one page html insert data in database

 public function add_about_us_section_a(){
$this->input->post('sub');
$value = $this->input->post();

      $data = array(
      'id' => $value['id'],
'main_heading' => $value['main_heading'],
'sub_heading' => $value['sub_heading'],
'message' => $value['message'],
);
$this->db->where('id',$data['id']);
      $this->db->update('add_about_us',$data);
$this->session->set_flashdata('success_msg', 'Record Add Successfully');
            redirect("admin/add_about_us");
    }


Take submit button name == (sub)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

codeigniter multiple form in one page html insert data in database

 Programing Coderfunda     December 20, 2018     codeigniter, insert, multiple form     No comments   

 codeigniter multiple form in one page html insert data in database

 public function add_about_us_section_a(){
$this->input->post('sub');
$value = $this->input->post();

      $data = array(
      'id' => $value['id'],
'main_heading' => $value['main_heading'],
'sub_heading' => $value['sub_heading'],
'message' => $value['message'],
);
$this->db->where('id',$data['id']);
      $this->db->update('add_about_us',$data);
$this->session->set_flashdata('success_msg', 'Record Add Successfully');
            redirect("admin/add_about_us");
    }


Take submit button name == (sub)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

19 December, 2018

Codeigniter Update the Data by database.

 Programing Coderfunda     December 19, 2018     codeigniter, update     No comments   


Codeigniter Update the Data by database.

Controller

public function edit_model_footer($id){

    $data['edit_model'] = $this->db->where('id',$id)->get('model_footer')->row_array();

$this->load->view('admin/edit_model_footer',$data);

}


Table Name: ==> model_footer

Page Name =>'admin/edit_model_footer'

Function ==> edit_model_footer.

$id = Taken by view pages where id already pass.


Model.

if you want to use the model then you can use this type code.

public function edit_model_footer (){

$this->db->where('id',$id)->get('model_footer')->row_array();
}

row_array ==> get one value by id.

result_array ==> get total data by database.





Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Codeigniter Update the Data by database.

 Programing Coderfunda     December 19, 2018     codeigniter, update     No comments   


Codeigniter Update the Data by database.

Controller

public function edit_model_footer($id){

    $data['edit_model'] = $this->db->where('id',$id)->get('model_footer')->row_array();

$this->load->view('admin/edit_model_footer',$data);

}


Table Name: ==> model_footer

Page Name =>'admin/edit_model_footer'

Function ==> edit_model_footer.

$id = Taken by view pages where id already pass.


Model.

if you want to use the model then you can use this type code.

public function edit_model_footer (){

$this->db->where('id',$id)->get('model_footer')->row_array();
}

row_array ==> get one value by id.

result_array ==> get total data by database.





Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

17 December, 2018

Update Images delete in Codeigniter

 Programing Coderfunda     December 17, 2018     codeigniter, Update images delete     No comments   


Update Images delete in Codeigniter


Image...

When you update images then your image will be delete then you use

A input tag and pass the value. Example Given blow....

(HTML)

<div>
<input class="brow-mainborsty" id="exampleInputFile"  type="file" name="img">
<input type="hidden" name="old_img" value="<?= $client['client_img'] ?>" required="">
</div>

<div class="col-md-4">
<img class="img_style_banner" src="<?php echo base_url();?>uploads/<?= $client['client_img'] ?>">
                     
    <input type="hidden" name="service_icon" value="icn_wireless.png" required="">
       </div>

(Codeigniter Code In Controller)

Start.

if($this->input->post()){
$inserclients['client_name'] = $this->input->post('client_name');
$inserclients['client_img'] = $this->input->post('old_img');
$config['upload_path']   = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
      $this->load->library('upload', $config);
      if ($this->upload->do_upload('img'))
      {
          $data = array('upload_data' => $this->upload->data());
          $img = $data['upload_data']['file_name'];
          $inserclients['client_img'] = $img;
      }
            $this->admin_model->update_client($id,$inserclients);
            $this->session->set_flashdata('update_client', 'Client Information Updated Successfully');
            redirect("admin/view_clients");
}


1)First you mention the value of ('old_img') in input name field
2) You Declair the value in post this type Exp. " $inserclients['client_img'] = $this->input->post('old_img');"
3)then you upload the images and your images will not we deleted when you will update forum.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Update Images delete in Codeigniter

 Programing Coderfunda     December 17, 2018     codeigniter, Update images delete     No comments   


Update Images delete in Codeigniter


Image...

When you update images then your image will be delete then you use

A input tag and pass the value. Example Given blow....

(HTML)

<div>
<input class="brow-mainborsty" id="exampleInputFile"  type="file" name="img">
<input type="hidden" name="old_img" value="<?= $client['client_img'] ?>" required="">
</div>

<div class="col-md-4">
<img class="img_style_banner" src="<?php echo base_url();?>uploads/<?= $client['client_img'] ?>">
                     
    <input type="hidden" name="service_icon" value="icn_wireless.png" required="">
       </div>

(Codeigniter Code In Controller)

Start.

if($this->input->post()){
$inserclients['client_name'] = $this->input->post('client_name');
$inserclients['client_img'] = $this->input->post('old_img');
$config['upload_path']   = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
      $this->load->library('upload', $config);
      if ($this->upload->do_upload('img'))
      {
          $data = array('upload_data' => $this->upload->data());
          $img = $data['upload_data']['file_name'];
          $inserclients['client_img'] = $img;
      }
            $this->admin_model->update_client($id,$inserclients);
            $this->session->set_flashdata('update_client', 'Client Information Updated Successfully');
            redirect("admin/view_clients");
}


1)First you mention the value of ('old_img') in input name field
2) You Declair the value in post this type Exp. " $inserclients['client_img'] = $this->input->post('old_img');"
3)then you upload the images and your images will not we deleted when you will update forum.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

11 December, 2018

Bootstrap - Forms

 Programing Coderfunda     December 11, 2018     Bootstrap - Forms, codeigniter     No comments   

Bootstrap - Forms


In this chapter, we will study how to create forms with ease using Bootstrap. Bootstrap makes it easy with the simple HTML markup and extended classes for different styles of forms. In this chapter we will study how to create forms with ease using Bootstrap.

Form Layout

Bootstrap provides you with following types of form layouts −
  • Vertical (default) form
  • In-line form
  • Horizontal form

Vertical or Basic Form

The basic form structure comes with Bootstrap; individual form controls automatically receive some global styling. To create a basic form do the following −
  • Add a role form to the parent <form> element.
  • Wrap labels and controls in a <div> with class .form-group. This is needed for optimum spacing.
  • Add a class of .form-control to all textual <input>, <textarea>, and <select> elements.
<form role = "form">

<div class = "form-group">
<label for = "name">Name</label>
<input type = "text" class = "form-control" id = "name" placeholder = "Enter Name">
</div>

<div class = "form-group">
<label for = "inputfile">File input</label>
<input type = "file" id = "inputfile">
<p class = "help-block">Example block-level help text here.</p>
</div>

<div class = "checkbox">
<label><input type = "checkbox"> Check me out</label>
</div>

<button type = "submit" class = "btn btn-default">Submit</button>
</form>

Inline Form

To create a form where all of the elements are inline, left aligned and labels are alongside, add the class .form-inline to the <form> tag.
<form class = "form-inline" role = "form">

<div class = "form-group">
<label class = "sr-only" for = "name">Name</label>
<input type = "text" class = "form-control" id = "name" placeholder = "Enter Name">
</div>

<div class = "form-group">
<label class = "sr-only" for = "inputfile">File input</label>
<input type = "file" id = "inputfile">
</div>

<div class = "checkbox">
<label><input type = "checkbox"> Check me out</label>
</div>

<button type = "submit" class = "btn btn-default">Submit</button>
</form>
  • By default inputs, selects, and textareas have 100% width in Bootstrap. You need to set a width on the form controls when using inline form.
  • Using the class .sr-only you can hide the labels of the inline forms.

Horizontal Form

Horizontal forms stands apart from the others not only in the amount of markup, but also in the presentation of the form. To create a form that uses the horizontal layout, do the following −
  • Add a class of .form-horizontal to the parent <form> element.
  • Wrap labels and controls in a <div> with class .form-group.
  • Add a class of .control-label to the labels.
<form class = "form-horizontal" role = "form">

<div class = "form-group">
<label for = "firstname" class = "col-sm-2 control-label">First Name</label>

<div class = "col-sm-10">
<input type = "text" class = "form-control" id = "firstname" placeholder = "Enter First Name">
</div>
</div>

<div class = "form-group">
<label for = "lastname" class = "col-sm-2 control-label">Last Name</label>

<div class = "col-sm-10">
<input type = "text" class = "form-control" id = "lastname" placeholder = "Enter Last Name">
</div>
</div>

<div class = "form-group">
<div class = "col-sm-offset-2 col-sm-10">
<div class = "checkbox">
<label><input type = "checkbox"> Remember me</label>
</div>
</div>
</div>

<div class = "form-group">
<div class = "col-sm-offset-2 col-sm-10">
<button type = "submit" class = "btn btn-default">Sign in</button>
</div>
</div>

</form>

Supported Form Controls

Bootstrap natively supports the most common form controls mainly input, textarea, checkbox, radio, and select.

Inputs

The most common form text field is the input field. This is where users will enter most of the essential form data. Bootstrap offers support for all native HTML5 input types: text, password, datetime, datetime-local, date, month, time, week, number, email, url, search, tel, and color. Proper type declaration is required to make Inputs fully styled.
<form role = "form">

<div class = "form-group">
<label for = "name">Label</label>
<input type = "text" class = "form-control" placeholder = "Text input">
</div>

</form>

Textarea

The textarea is used when you need multiple lines of input. Change rows attribute as necessary (fewer rows = smaller box, more rows = bigger box).
<form role = "form">

<div class = "form-group">
<label for = "name">Text Area</label>
<textarea class = "form-control" rows = "3"></textarea>
</div>

</form>

CheckBoxes and Radio Buttons

Checkboxes and radio buttons are great when you want users to choose from a list of preset options.
  • When building a form, use checkbox if you want the user to select any number of options from a list. Use radio if you want to limit the user to just one selection.
  • Use .checkbox-inline or .radio-inline class to a series of checkboxes or radios for controls appear on the same line.
The following example demonstrates both (default and inline) types −
<label for = "name">Example of Default Checkbox and radio button </label>

<div class = "checkbox">
<label>
<input type = "checkbox" value = "">Option 1
</label>
</div>

<div class = "checkbox">
<label>
<input type = "checkbox" value = "">Option 2
</label>
</div>

<div class = "radio">
<label>
<input type = "radio" name = "optionsRadios" id = "optionsRadios1" value = "option1" checked> Option 1
</label>
</div>

<div class = "radio">
<label>
<input type = "radio" name = "optionsRadios" id = "optionsRadios2" value = "option2">
Option 2 - selecting it will deselect option 1
</label>
</div>

<label for = "name">Example of Inline Checkbox and radio button </label>

<div>
<label class = "checkbox-inline">
<input type = "checkbox" id = "inlineCheckbox1" value = "option1"> Option 1
</label>

<label class = "checkbox-inline">
<input type = "checkbox" id = "inlineCheckbox2" value = "option2"> Option 2
</label>

<label class = "checkbox-inline">
<input type = "checkbox" id = "inlineCheckbox3" value = "option3"> Option 3
</label>

<label class = "checkbox-inline">
<input type = "radio" name = "optionsRadiosinline" id = "optionsRadios3" value = "option1" checked> Option 1
</label>

<label class = "checkbox-inline">
<input type = "radio" name = "optionsRadiosinline" id = "optionsRadios4" value = "option2"> Option 2
</label>
</div>

Selects

A select is used when you want to allow the user to pick from multiple options, but by default it only allows one.
  • Use <select> for list options with which the user is familiar, such as states or numbers.
  • Use multiple = "multiple" to allow the users to select more than one option.
The following example demonstrates both (select and multiple) types −
<form role = "form">

<div class = "form-group">
<label for = "name">Select list</label>

<select class = "form-control">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>

<label for = "name">Mutiple Select list</label>

<select multiple class = "form-control">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>

</div>

</form>

Static Control

Use the class .form-control-static on a <p>, when you need to place plain text next to a form label within a horizontal form.
<form class = "form-horizontal" role = "form">
<div class = "form-group">
<label class = "col-sm-2 control-label">Email</label>

<div class = "col-sm-10">
<p class = "form-control-static">email@example.com</p>
</div>

</div>

<div class = "form-group">
<label for = "inputPassword" class = "col-sm-2 control-label">Password</label>

<div class = "col-sm-10">
<input type = "password" class = "form-control" id = "inputPassword" placeholder = "Password">
</div>

</div>
</form>

Form Control States

In addition to the :focus (i.e., a user clicks into the input or tabs onto it) state, Bootstrap offers styling for disabled inputs and classes for form validation.

Input Focus

When an input receives :focus, the outline of the input is removed and a box-shadow is applied.

Disabled lnputs

If you need to disable an input, simply adding the disabled attribute will not only disable it; it will also change the styling and the mouse cursor when the cursor hovers over the element.

Disabled Fieldsets

Add the disabled attribute to a <fieldset> to disable all the controls within the <fieldset> at once.

Validation States

Bootstrap includes validation styles for errors, warnings, and success messages. To use, simply add the appropriate class (.has-warning, .has-error, or .has-success) to the parent element.
The following example demonstrates all the form control states −
<form class = "form-horizontal" role = "form">

<div class = "form-group">
<label class = "col-sm-2 control-label">Focused</label>

<div class = "col-sm-10">
<input class = "form-control" id = "focusedInput" type = "text" value = "This is focused...">
</div>
</div>

<div class = "form-group">
<label for = "inputPassword" class = "col-sm-2 control-label">Disabled</label>

<div class = "col-sm-10">
<input class = "form-control" id = "disabledInput" type = "text" placeholder = "Disabled input here..." disabled>
</div>
</div>

<fieldset disabled>
<div class = "form-group">

<label for = "disabledTextInput" class = "col-sm-2 control-label">
Disabled input (Fieldset disabled)
</label>

<div class = "col-sm-10">
<input type = "text" id = "disabledTextInput" class = "form-control" placeholder = "Disabled input">
</div>
</div>

<div class = "form-group">
<label for = "disabledSelect" class = "col-sm-2 control-label">
Disabled select menu (Fieldset disabled)
</label>

<div class = "col-sm-10">
<select id = "disabledSelect" class = "form-control">
<option>Disabled select</option>
</select>
</div>

</div>
</fieldset>

<div class = "form-group has-success">
<label class = "col-sm-2 control-label" for = "inputSuccess">
Input with success
</label>

<div class = "col-sm-10">
<input type = "text" class = "form-control" id = "inputSuccess">
</div>
</div>

<div class = "form-group has-warning">
<label class = "col-sm-2 control-label" for = "inputWarning">
Input with warning
</label>

<div class = "col-sm-10">
<input type = "text" class = "form-control" id = "inputWarning">
</div>
</div>

<div class = "form-group has-error">
<label class = "col-sm-2 control-label" for = "inputError">
Input with error
</label>

<div class = "col-sm-10">
<input type = "text" class = "form-control" id = "inputError">
</div>

</div>

</form>

Form Control Sizing

You can set heights and widths of forms using classes like .input-lg and .col-lg-* respectively. The following example demonstrates this −
<form role = "form">

<div class = "form-group">
<input class = "form-control input-lg" type = "text" placeholder =".input-lg">
</div>

<div class = "form-group">
<input class = "form-control" type = "text" placeholder = "Default input">
</div>

<div class = "form-group">
<input class = "form-control input-sm" type = "text" placeholder = ".input-sm">
</div>

<div class = "form-group"></div>

<div class = "form-group">
<select class = "form-control input-lg">
<option value = "">.input-lg</option>
</select>
</div>

<div class = "form-group">
<select class = "form-control">
<option value = "">Default select</option>
</select>
</div>

<div class = "form-group">
<select class = "form-control input-sm">
<option value = "">.input-sm</option>
</select>
</div>

<div class = "row">
<div class = "col-lg-2">
<input type = "text" class = "form-control" placeholder = ".col-lg-2">
</div>

<div class = "col-lg-3">
<input type = "text" class = "form-control" placeholder = ".col-lg-3">
</div>

<div class = "col-lg-4">
<input type = "text" class = "form-control" placeholder = ".col-lg-4">
</div>

</div>
</form>

Help Text

Bootstrap form controls can have a block level help text that flows with the inputs. To add a full width block of content, use the .help-block after the <input>. The following example demonstrates this −
<form role = "form">
<span>Example of Help Text</span>
<input class = "form-control" type = "text" placeholder = "">

<span class = "help-block">
A longer block of help text that breaks onto a new line and may extend beyond one line.
</span>

</form>
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Bootstrap - Forms

 Programing Coderfunda     December 11, 2018     Bootstrap - Forms, codeigniter     No comments   

Bootstrap - Forms


In this chapter, we will study how to create forms with ease using Bootstrap. Bootstrap makes it easy with the simple HTML markup and extended classes for different styles of forms. In this chapter we will study how to create forms with ease using Bootstrap.

Form Layout

Bootstrap provides you with following types of form layouts −
  • Vertical (default) form
  • In-line form
  • Horizontal form

Vertical or Basic Form

The basic form structure comes with Bootstrap; individual form controls automatically receive some global styling. To create a basic form do the following −
  • Add a role form to the parent <form> element.
  • Wrap labels and controls in a <div> with class .form-group. This is needed for optimum spacing.
  • Add a class of .form-control to all textual <input>, <textarea>, and <select> elements.
<form role = "form">

   <div class = "form-group">
      <label for = "name">Name</label>
      <input type = "text" class = "form-control" id = "name" placeholder = "Enter Name">
   </div>
   
   <div class = "form-group">
      <label for = "inputfile">File input</label>
      <input type = "file" id = "inputfile">
      <p class = "help-block">Example block-level help text here.</p>
   </div>
   
   <div class = "checkbox">
      <label><input type = "checkbox"> Check me out</label>
   </div>
   
   <button type = "submit" class = "btn btn-default">Submit</button>
</form>

Inline Form

To create a form where all of the elements are inline, left aligned and labels are alongside, add the class .form-inline to the <form> tag.
<form class = "form-inline" role = "form">
   
   <div class = "form-group">
      <label class = "sr-only" for = "name">Name</label>
      <input type = "text" class = "form-control" id = "name" placeholder = "Enter Name">
   </div>
   
   <div class = "form-group">
      <label class = "sr-only" for = "inputfile">File input</label>
      <input type = "file" id = "inputfile">
   </div>
   
   <div class = "checkbox">
      <label><input type = "checkbox"> Check me out</label>
   </div>
   
   <button type = "submit" class = "btn btn-default">Submit</button>
</form>
  • By default inputs, selects, and textareas have 100% width in Bootstrap. You need to set a width on the form controls when using inline form.
  • Using the class .sr-only you can hide the labels of the inline forms.

Horizontal Form

Horizontal forms stands apart from the others not only in the amount of markup, but also in the presentation of the form. To create a form that uses the horizontal layout, do the following −
  • Add a class of .form-horizontal to the parent <form> element.
  • Wrap labels and controls in a <div> with class .form-group.
  • Add a class of .control-label to the labels.
<form class = "form-horizontal" role = "form">
   
   <div class = "form-group">
      <label for = "firstname" class = "col-sm-2 control-label">First Name</label>
  
      <div class = "col-sm-10">
         <input type = "text" class = "form-control" id = "firstname" placeholder = "Enter First Name">
      </div>
   </div>
   
   <div class = "form-group">
      <label for = "lastname" class = "col-sm-2 control-label">Last Name</label>
  
      <div class = "col-sm-10">
         <input type = "text" class = "form-control" id = "lastname" placeholder = "Enter Last Name">
      </div>
   </div>
   
   <div class = "form-group">
      <div class = "col-sm-offset-2 col-sm-10">
         <div class = "checkbox">
            <label><input type = "checkbox"> Remember me</label>
         </div>
      </div>
   </div>
   
   <div class = "form-group">
      <div class = "col-sm-offset-2 col-sm-10">
         <button type = "submit" class = "btn btn-default">Sign in</button>
      </div>
   </div>
 
</form>

Supported Form Controls

Bootstrap natively supports the most common form controls mainly input, textarea, checkbox, radio, and select.

Inputs

The most common form text field is the input field. This is where users will enter most of the essential form data. Bootstrap offers support for all native HTML5 input types: text, password, datetime, datetime-local, date, month, time, week, number, email, url, search, tel, and color. Proper type declaration is required to make Inputs fully styled.
<form role = "form">
   
   <div class = "form-group">
      <label for = "name">Label</label>
      <input type = "text" class = "form-control" placeholder = "Text input">
   </div>
  
</form>

Textarea

The textarea is used when you need multiple lines of input. Change rows attribute as necessary (fewer rows = smaller box, more rows = bigger box).
<form role = "form">
   
   <div class = "form-group">
      <label for = "name">Text Area</label>
      <textarea class = "form-control" rows = "3"></textarea>
   </div>
   
</form>

CheckBoxes and Radio Buttons

Checkboxes and radio buttons are great when you want users to choose from a list of preset options.
  • When building a form, use checkbox if you want the user to select any number of options from a list. Use radio if you want to limit the user to just one selection.
  • Use .checkbox-inline or .radio-inline class to a series of checkboxes or radios for controls appear on the same line.
The following example demonstrates both (default and inline) types −
<label for = "name">Example of Default Checkbox and radio button </label>

<div class = "checkbox">
   <label>
      <input type = "checkbox" value = "">Option 1
   </label>
</div>

<div class = "checkbox">
   <label>
      <input type = "checkbox" value = "">Option 2
   </label>
</div>

<div class = "radio">
   <label>
      <input type = "radio" name = "optionsRadios" id = "optionsRadios1" value = "option1" checked> Option 1
   </label>
</div>

<div class = "radio">
   <label>
      <input type = "radio" name = "optionsRadios" id = "optionsRadios2" value = "option2">
      Option 2 - selecting it will deselect option 1
   </label>
</div>

<label for = "name">Example of Inline Checkbox and radio button </label>

<div>
   <label class = "checkbox-inline">
      <input type = "checkbox" id = "inlineCheckbox1" value = "option1"> Option 1
   </label>
   
   <label class = "checkbox-inline">
      <input type = "checkbox" id = "inlineCheckbox2" value = "option2"> Option 2
   </label>
   
   <label class = "checkbox-inline">
      <input type = "checkbox" id = "inlineCheckbox3" value = "option3"> Option 3
   </label>
   
   <label class = "checkbox-inline">
      <input type = "radio" name = "optionsRadiosinline" id = "optionsRadios3" value = "option1" checked> Option 1
   </label>
   
   <label class = "checkbox-inline">
      <input type = "radio" name = "optionsRadiosinline" id = "optionsRadios4" value = "option2"> Option 2
   </label>
</div>

Selects

A select is used when you want to allow the user to pick from multiple options, but by default it only allows one.
  • Use <select> for list options with which the user is familiar, such as states or numbers.
  • Use multiple = "multiple" to allow the users to select more than one option.
The following example demonstrates both (select and multiple) types −
<form role = "form">
   
   <div class = "form-group">
      <label for = "name">Select list</label>
      
      <select class = "form-control">
         <option>1</option>
         <option>2</option>
         <option>3</option>
         <option>4</option>
         <option>5</option>
      </select>

      <label for = "name">Mutiple Select list</label>
      
      <select multiple class = "form-control">
         <option>1</option>
         <option>2</option>
         <option>3</option>
         <option>4</option>
         <option>5</option>
      </select>
      
   </div>
 
</form>

Static Control

Use the class .form-control-static on a <p>, when you need to place plain text next to a form label within a horizontal form.
<form class = "form-horizontal" role = "form">
   <div class = "form-group">
      <label class = "col-sm-2 control-label">Email</label>
      
      <div class = "col-sm-10">
         <p class = "form-control-static">email@example.com</p>
      </div>
      
   </div>
   
   <div class = "form-group">
      <label for = "inputPassword" class = "col-sm-2 control-label">Password</label>
      
      <div class = "col-sm-10">
         <input type = "password" class = "form-control" id = "inputPassword" placeholder = "Password">
      </div>
      
   </div>
</form>

Form Control States

In addition to the :focus (i.e., a user clicks into the input or tabs onto it) state, Bootstrap offers styling for disabled inputs and classes for form validation.

Input Focus

When an input receives :focus, the outline of the input is removed and a box-shadow is applied.

Disabled lnputs

If you need to disable an input, simply adding the disabled attribute will not only disable it; it will also change the styling and the mouse cursor when the cursor hovers over the element.

Disabled Fieldsets

Add the disabled attribute to a <fieldset> to disable all the controls within the <fieldset> at once.

Validation States

Bootstrap includes validation styles for errors, warnings, and success messages. To use, simply add the appropriate class (.has-warning, .has-error, or .has-success) to the parent element.
The following example demonstrates all the form control states −
<form class = "form-horizontal" role = "form">

   <div class = "form-group">
      <label class = "col-sm-2 control-label">Focused</label>
      
      <div class = "col-sm-10">
         <input class = "form-control" id = "focusedInput" type = "text" value = "This is focused...">
      </div>
   </div>
   
   <div class = "form-group">
      <label for = "inputPassword" class = "col-sm-2 control-label">Disabled</label>
      
      <div class = "col-sm-10">
         <input class = "form-control" id = "disabledInput" type = "text" placeholder = "Disabled input here..." disabled>
      </div>
   </div>
   
   <fieldset disabled>
      <div class = "form-group">
         
         <label for = "disabledTextInput"  class = "col-sm-2 control-label">
            Disabled input (Fieldset disabled)
         </label>
         
         <div class = "col-sm-10">
            <input type = "text" id = "disabledTextInput" class = "form-control" placeholder = "Disabled input">
         </div>
      </div>
      
      <div class = "form-group">
         <label for = "disabledSelect"  class = "col-sm-2 control-label">
            Disabled select menu (Fieldset disabled)
         </label>
         
         <div class = "col-sm-10">
            <select id = "disabledSelect" class = "form-control">
               <option>Disabled select</option>
            </select>
         </div>
         
      </div>
   </fieldset>
   
   <div class = "form-group has-success">
      <label class = "col-sm-2 control-label" for = "inputSuccess">
         Input with success
      </label>
      
      <div class = "col-sm-10">
         <input type = "text" class = "form-control" id = "inputSuccess">
      </div>
   </div>
   
   <div class = "form-group has-warning">
      <label class = "col-sm-2 control-label" for = "inputWarning">
         Input with warning
      </label>
      
      <div class = "col-sm-10">
         <input type = "text" class = "form-control" id = "inputWarning">
      </div>
   </div>
   
   <div class = "form-group has-error">
      <label class = "col-sm-2 control-label" for = "inputError">
         Input with error
      </label>
      
      <div class = "col-sm-10">
         <input type = "text" class = "form-control" id = "inputError">
      </div>
      
   </div>
 
</form>

Form Control Sizing

You can set heights and widths of forms using classes like .input-lg and .col-lg-* respectively. The following example demonstrates this −
<form role = "form">

   <div class = "form-group">
      <input class = "form-control input-lg" type = "text" placeholder =".input-lg">
   </div>

   <div class = "form-group">
      <input class = "form-control" type = "text" placeholder = "Default input">
   </div>

   <div class = "form-group">
      <input class = "form-control input-sm" type = "text" placeholder = ".input-sm">
   </div>
   
   <div class = "form-group"></div>
   
   <div class = "form-group">
      <select class = "form-control input-lg">
         <option value = "">.input-lg</option>
      </select>
   </div>
   
   <div class = "form-group">
      <select class = "form-control">
         <option value = "">Default select</option>
      </select>
   </div>
   
   <div class = "form-group">
      <select class = "form-control input-sm">
         <option value = "">.input-sm</option>
      </select>
   </div>

   <div class = "row">
      <div class = "col-lg-2">
         <input type = "text" class = "form-control" placeholder = ".col-lg-2">
      </div>
      
      <div class = "col-lg-3">
         <input type = "text" class = "form-control" placeholder = ".col-lg-3">
      </div>
      
      <div class = "col-lg-4">
         <input type = "text" class = "form-control" placeholder = ".col-lg-4">
      </div>
      
   </div>
</form>

Help Text

Bootstrap form controls can have a block level help text that flows with the inputs. To add a full width block of content, use the .help-block after the <input>. The following example demonstrates this −
<form role = "form">
   <span>Example of Help Text</span>
   <input class = "form-control" type = "text" placeholder = "">
   
   <span class = "help-block">
      A longer block of help text that breaks onto a new line and may extend beyond one line.
   </span>
 
</form>
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Older Posts Home

Meta

Popular Posts

  • Sitaare Zameen Par Full Movie Review
     Here’s a  complete Vue.js tutorial for beginners to master level , structured in a progressive and simple way. It covers all essential topi...
  • C++ in Hindi Introduction
    C ++ का परिचय C ++ एक ऑब्जेक्ट ओरिएंटेड प्रोग्रामिंग लैंग्वेज है। C ++ को Bjarne Stroustrup द्वारा विकसित किया गया था। C ++ में आने से पह...
  • Write API Integrations in Laravel and PHP Projects with Saloon
    Write API Integrations in Laravel and PHP Projects with Saloon Saloon  is a Laravel/PHP package that allows you to write your API integratio...
  • Credit card validation in laravel
      Validation rules for credit card using laravel-validation-rules/credit-card package in laravel Install package laravel-validation-rules/cr...
  • iOS 17 Force Screen Rotation not working on iPAD only
    I have followed all the links on Google and StackOverFlow, unfortunately, I could not find any reliable solution Specifically for iPad devic...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (69)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • July (4)
  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda