Skip to content

Instantly share code, notes, and snippets.

View Rameshwar-ghodke's full-sized avatar
💭
working as Web Designer

Rameshwar ghodke Rameshwar-ghodke

💭
working as Web Designer
View GitHub Profile
<!DOCTYPE html>
<html>
<style>
form {
border: 3px solid #f1f1f1;
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
Change the config file base url as-
$config['base_url'] = 'http://localhost/';
after that change the database pathin database.php file in config folder as --
'hostname' => 'localhost',
'username' => 'root',
'password' => 'root',
'database' => 'login',
'dbdriver' => 'mysqli',
<?php
$servername = "localhost";
$username = "username";
$password = "password";
try {
$conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDBPDO";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
In this example, when a user types a character in the input field, a function called "showHint()" is executed.
The function is triggered by the onkeyup event.
eg-----
<html>
<head>
<script>
function showHint(str) {
if (str.length == 0) {
document.getElementById("txtHint").innerHTML = "";
<html>
<head>
<script>
function showUser(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ edge/index.php?/$1 [L]
</IfModule>z
// first call the following log() function in your controller
eg :-
function log()
{
//$this->load->helper(array('url'));
$this->load->view('login_view');
}
// this function call through the form after submit the login form
eg:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
include getcwd()."/application/config/config.php";
$base_url = $config['base_url'];
?>
<link href="<?=$base_url?>style/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
// insert into stud table value using codegnitor
$data = array(
'roll_no' => ‘1’,
'name' => ‘Virat’
);
$this->db->insert("stud", $data);
// Update query using codegnitor