Posts

Showing posts from September, 2021

How to Create Dynamic Dependent select box using ajax

Image
  You need a dynamic dependent select box. We will explain how to create a dynamic dependent select box in PHP, jquery and ajax. index.php <?php include_once 'dbconfig.php'; ?> <html> <head> <title>Dynamic Dependent Select Box using Ajax</title> <script type="text/javascript" src="jquery-1.4.1.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#loding1").hide(); $("#loding2").hide(); $(".country").change(function() { $("#loding1").show(); var id=$(this).val(); var dataString = 'id='+ id; $(".state").find('option').remove(); $(".city").find('option').remove(); $.ajax ({ type: "POST", url: "get_state.php", data: dataString, cache: false, success: function(html) { $("#loding1").hide(); $(".state").html(html

How to Fetch Logged in Username

Image
  after login, we need to fetch the Username. We will explain How to Fetch Logged in the Username. index.php <?php include("db.php"); session_start(); if($_SESSION['username']=="") { session_destroy(); header("location:index.php"); } ?> <html> <head> <title>Fetch Loged in Username</title> </head> </body> <?php include('db.php'); $query="select * from user where username='".$_SESSION['username']."' "; $query1=mysql_query($query); $row=mysql_fetch_array($query1) ?> <h1> <?php echo $row['name']; ?></h1> </body> </html> db.php <?php mysql_connect('localhost','root',''); mysql_select_db('database'); ?>

How to Make Fees Receipt in PHP Using Mysql Database

Image
  In this article, you will learn How to Make Fees Receipt in PHP Using Mysql Database. index.php <html> <title>Add fees</title> </head> <body> <h1><a href="add.php">Add receipt</a> &nbsp &nbsp &nbsp <a href="search.php">Record</a></h1> <form method="POST" oninput="x.value=parseInt(a.value)+parseInt(b.value)+parseInt(c.value)" action="fees.php"> <input type="date" name="date"><br/><br/> Name <input type="text" name="name"><br/><br/> Registration No. <input type="number" name="rno"><br/><br/> Course <select name="course"> <option>Select Course</option> <option value="PHP">PHP</option> <option value="JAVA">JAVA</option> <option value="ACCOUNTS

How to Create a Login system in PHP Using a Session

Image
In this article, we will explain how to create a login system in PHP using a session. ['username']!=$username && $row['password']!=$password) { $error="<p>Wrong User Name and Password</p>"; } if(isset($error)) { echo $error; } else{ require('db.php'); session_start(); $result =mysql_query("select * from users where username='$username' and password='$password'"); while($row=mysql_fetch_array($result)) { $_SESSION['username']=$row['username']; echo"<script>window.location.href='../invoice/'</script>"; } } } ?> db.php <?php mysql_connect('localhost','root',''); mysql_select_db('testbill'); ?>  

How to Fetch Data From Mysql Database using PHP

Image
  How to Fetch Data From Mysql Database using PHP, from inserted data in Mysql database. HTML Code <div class="table"> <div class="tab1"><h1>Name</h1></div> <div class="tab1"><h1>Father name</h1></div> <div class="tab1"><h1>Mother name</h1></div> <div class="tab1"><h1>E-mail</h1></div> <div class="tab1"><h1>Address</h1></div> <div class="tab1"><h1>DOB</h1></div> <div class="tab1"><h1>Category</h1></div> <div class="tab1"><h1>Image</h1></div> <div class="tab1"><h1>Action</h1></div> <div class="tab1"><h1>Delete</h1></div> <?php $query1 = "select * from table"; $query2 = mysql_query($q

How to Insert Data into Mysql Database using PHP

Image
In this tutorial, we will explain How to insert data into Mysql database using  PHP . If you want to save the record in one place then insert the data into the database. Below Steps: index.php <form method="post" action="insert.php" enctype="multipart/form-data"> <div class="name"> <div class="name1"><h1>Student Name:</h1></div> <div class="name2"><input type="text" name="name" value="" /></div> </div> <div class="name"> <div class="name1"><h1>Father Name:</h1></div> <div class="name2"><input type="text" name="father_name" value="" /></div> </div> <div class="name"> <div class="name1"><h1>Mother Name:</h1></div> <div class="name2"><input type="text

How to Create Input using JAVA

Image
In this article, you will learn How to Create Input using JAVA. It works like in  HTML  and  PHP Example:- import java.util.Scanner; // import the Scanner class class MyClass { public static void main(String[] args) { Scanner myObj = new Scanner(System.in); String userName; System.out.println("Enter username"); userName = myObj.nextLine(); System.out.println("Username is: " + userName); } }  

How to Create Inheritance in JAVA

Image
In this article, you will learn How to Create Inheritance in  JAVA . Example:- class Vehicle { protected String brand = "Samsung"; public void honk() { System.out.println("Mobile, LED!"); } } class Car extends Vehicle { private String modelName = "Galaxy"; public static void main(String[] args) { Car myFastCar = new Car(); myFastCar.honk(); System.out.println(myFastCar.brand + " " + myFastCar.modelName); } }  

How to Create Polymorphism in JAVA

Image
  In this article, you will learn How to Create Polymorphism in  JAVA . Example:- class Animal { public void animalSound() { System.out.println("The animal makes a sound"); } } class Pig extends Animal { public void animalSound() { System.out.println("The pig says: wee wee"); } } class Dog extends Animal { public void animalSound() { System.out.println("The dog says: bow wow"); } } class MyMainClass { public static void main(String[] args) { Animal myAnimal = new Animal(); Animal myPig = new Pig(); Animal myDog = new Dog(); myAnimal.animalSound(); myPig.animalSound(); myDog.animalSound(); } }

How to use File Open or Read in PHP

Image
In this article, you will learn How to use File Open or Read in PHP. A method to open file in PHP fopen() function. This function provides you many options than the readfile() function. We can use the type of file with this function. AJAX = Asynchronous JavaScript and XML CSS  = Cascading Style Sheets HTML = Hyper Text Markup Language PHP = PHP Hypertext Preprocessor SQL  = Structured Query Language SVG = Scalable Vector Graphics XML = EXtensible Markup Language Example:- index.php <?php $myfile = fopen("file.txt", "r") or die("Unable to open file!"); echo fread($myfile,filesize("webdictionary.txt")); fclose($myfile); ?> file.txt Welcome to Hub of Tutorials  

How to Generate PDF from MySQL Database

Image
In this article, you will learn How to Generate PDF from  MySQL  Database. Example:- Table of Employees CREATE TABLE IF NOT EXISTS `employee` ( `EmpId` int(11) NOT NULL, `EmpName` varchar(200) DEFAULT NULL, `EmpDepartment` varchar(200) DEFAULT NULL, `EmpRegDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; INSERT INTO `employee` (`EmpId`, `EmpName`, `EmpDepartment`, `EmpRegDate`) VALUES (1, 'Amandeep Singh', 'Designing', '2017-03-18 11:37:00'), (2, 'Baljit Singh ', 'HR', '2017-06-12 06:32:11'), (3, 'Deepak', 'Tester', '2017-02-13 02:42:39'), (4, 'Gurtej Singh', 'Designing', '2018-05-15 05:28:36'), (5, 'Jaspreet Kaur', 'Development', '2018-04-19 06:12:00'), (6, 'Sachin Sharma', 'Graphics Designer', '2018-11-11 02:31:00'); ALTER TABLE `tblemployee` ADD PRIMARY KEY (`EmpId`); ALTER TABLE `t

How to Maintain Password History Using PHP and Mysql

Image
In this article, you will learn How to Maintain Password History Using PHP and M ysql.  In this user change their password can’t reuse. New Password should not be the same as any of the previous 3 Passwords. In this tutorial having three pages db.php index.php change_password.php db.php <?php define('DB_HOST','localhost'); define('DB_USER','root'); define('DB_PASS',''); define('DB_NAME','pwdhistory'); try { $dbh = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME,DB_USER, DB_PASS,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'")); } catch (PDOException $e) { exit("Error: " . $e->getMessage()); } ?> index.php <?php session_start(); error_reporting(0); include('db.php'); if(isset($_POST['submit'])) { $fullname=$_POST['fname']; $email=$_POST['email']; $password=md5($_POST['password']); // Code for check email avail

How to Create CSS Image Sprites

Image
In this article, you will learn How to Create  CSS   Image  Sprites. Example:- <html> <head> <title>CSS Image Sprites</title> <style> #navlist { position: relative; } #navlist li { margin: 0; padding: 0; list-style: none; position: absolute; top: 0; } #navlist li, #navlist a { height: 44px; display: block; } #home { left: 0px; width: 46px; background: url('home.png') 0 0; } #prev { left: 63px; width: 43px; background: url('pre.png') -47px 0; } #next { left: 129px; width: 43px; background: url('next.png') -91px 0; } </style> </head> <body> <ul id="navlist"> <li id="home"><a href="https://huboftutorials.com/"></a></li> <li id="prev"><a href="https://huboftutorials.com/category/jquery"></a></li> <li id="next"><a href="https://huboftutorials.com/cascadin