My new website launch. available article for Codeigniter-4, Vuejs, React Native etc.
fulstackdev.com
Deesoft Service
Design Development Marketing
menu
Home
About Us
Service
Portfolio
Help Center
Question Answer
Tutorials
Blogs
Contact Us
Home
About Us
Success Story
Our Mission
Why Deesoft Service
Service
Web Design
Web Development
SEO
New
Portfolio
Help Center
Question Answer
Tutorials
Code Tutorial
Video Tutorial
Blogs
Contact Us
Success Story
New
Our Mission
Why Deesoft Service
Web Design
Web Development
SEO
New
Code Tutorial
New
Video Tutorial
Tutorial List
Create Controller
Create View
Autoload Helper
Autoload Library
Remove index.php
Connect CSS & JS File
Create Form
Form Validation
Create Database
Connect Database
Insert Data
Flash Message
View - index.php
Create Simple Form
= link_tag('asset/css/style.css'); ?>
This is Simple Form
= form_open("Home/insert_data"); ?> = form_label('First Name'); ?> = form_input(['name'=>'first_name']); ?> = validation_errors(''); ?> = "
"; ?> = form_label('Last Name'); ?> = form_input(['name'=>'last_name']); ?> = "
"; ?> = form_label('Mobile No.'); ?> = form_input(['name'=>'mobile_no']); ?> = "
"; ?> = form_submit('submit','Register Form'); ?> = form_close(); ?>
Controller - Home.php
public function insert_data() { $this->load->model('HomeModel'); $result = $this->HomeModel->insert_data(); if($result){ echo"Data Insert Successfully."; } else{ echo "Error ! Data Insert"; } }
Model - HomeModel.php
class HomeModel extends CI_Model { public function insert_data() { $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); $mobile_no = $this->input->post('mobile_no'); $insert_data = $this->db->insert('users',['user_first_name'=>$first_name, 'user_last_name'=>$last_name, 'user_mobile'=>$mobile_no]); if($insert_data){ return true; } else{ return false; } } }