Showing posts with label codeigniter. Show all posts
Showing posts with label codeigniter. Show all posts

Upload Images/GIf file in php with codeigniter framework

Upload Images/Gif file in php with codeigniter framework its easy steps to make upload file functionality in codeigniter  create upload folder in assets/img and then first create a file in

Step 1 application/controller/Fileupload.php

and  this code in the file

Upload video file in php with codeigniter framework

Upload video file in php with codeigniter framework its easy steps to make upload file functionality in codeigniter first create a file in

Step 1 application/controller/Fileupload.php

and  this code in the file

Upload a doc file in php using codeigniter

Upload doc file in php with codeigniter framework its easy steps to make upload file functionality in codeigniter first create a file in

Step 1 application/controller/Fileupload.php

and  this code in the file

How to get a list of data in codeigniter using php

In this tutorial learn how to get a list of data in codeigniter using php, Its easy to get data list from view to controller,  Create a Signup.php in controller  keep first letter capital and create a file signup.php in view now  same get list for create a User.php in controller and user.php in view

Controller

application/controller/Signup.php


<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Signup extends CI_Controller {

public function index()
{

//controller part to get value and insert into the database

    $message="";
 
    if(isset($_POST['btnsignup'])){
        //value get
        $name=$this->input->post('name');
        $email=$this->input->post('email');
        $pass=$this->input->post('password');
        $address=$this->input->post('address');

  //here insert the data before we need to connect the data

  // now also load the database file
 $insdata=array('name'=>$name,'email'=>$email,'pass'=>$pass,'address'=>$address);    

        $this->db->insert('login',$insdata);

 $message="Thank You successfully registered";
   
      }

$data['message']=$message;

$this->load->view('pages/signup',$data);
 
}
}

application/view/pages/signup.php

<html>
<head>
<title>Sign up</title>
<style type="text/css">
input{
font-family: "Helvetica","Arial",sans-serif;
    margin: 0;
    padding: 4px 0;
    width: 207px;
    background: 0 0;
    text-align: left;
    }
#submit{
background-color: skyblue;
text-align: center;

}  

<?-- view signup data of form detail -->  
</style>
</head>
<body>
<div style="text-align:center;margin-top: 8%;">
<h1> Sign up</h1>
<div style="color:green">
<?php echo $message; ?>  <br/><br/>
</div>
<form action="" method="post">

<input type="text" name="name" value="name" /><br/><br/>
<input type="email" name="email" value="email" /><br/><br/>
<input type="password" name="password" value="password" /><br/><br/>
<input type="address" name="address" value="address" /><br/><br/>
<input type="submit" name="btnsignup" id="submit" value="submit" />
</form>
</div>
</body>
</html>


Controller

application/controller/User.php

User.php

<?php defined('BASEPATH') OR exit('No direct script access allowed');

class User extends CI_Controller {

public function index()
{

//pages to call

$this->load->view('pages/user');

   }
 
 }

 application/view/ user.php



<?php


$query = $this->db->query("SELECT * FROM login;"); ?>


<div style="text-align:center">
<h1>User List</h1>
<table style="text-align:center;margin-left: 38%;">
<thead>
<tr>
<th> name</th>
<th> Email</th>
<th> Password</th>
<th> Address</th>
</tr>
</thead>
<tbody>

<?php
foreach ($query->result('User') as $user)
{ ?>
<tr>
 <td>
    <?=$user->name;?>
 </td>
 <td>
    <?=$user->email;?>
 </td>
  <td>
    <?=$user->pass;?>
 </td>
  <td>
    <?=$user->address;?>
 </td>

</tr>            
 <?php        
}
?>

</tbody>
</table>
</div>





How to generate form using form helper in php with codeigniter framework?

Generate form using form helper class in php with codeigniter  framework , to generate dynamic form. Loading this Helper

This helper is loaded using the following code (to controller class):

$this->load->helper('form');

 Here’s a simple example:

echo form_open('home');

The above example would create a form that points to your base URL plus the “email/send” URI
segments, like this:


<form method="post" accept-charset="utf-8" action="http://example.com/index.php/home">

How to display records using database in php using codeigniter framework ?

In the Codeigniter display records/fetch using database with MYSQL and foreach, This tutorial is intended to introduce you to the CodeIgniter framework and the basic principles of MVC architecture. It will show you how a basic CodeIgniter application is constructed in step-by-step fashion.

Static pages

Note: This tutorial assumes you’ve downloaded CodeIgniter and installed the framework in your development environment.

Redirect Issue in the website

Codeigniter website Redirect Issue in the website, redirect issue with website in a linux ,redirect issue with website url in codeigniter in linux here fix the redirect issue using add command to apache server config file


1. Run command in terminal 

sudo a2enmod rewrite


2.  Go to the apache2 directory and edit the file using command  sudo vi apache2.conf


cd /etc/apache2
sudo vi apache2.conf


how to call ssh from vs code

 To call SSH from VS Code, you can use the built-in Remote Development extension. This extension allows you to open a remote folder or works...