This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include('connect.php'); | |
//insert data into database | |
if(isset($_POST['save'])){ | |
$name=$_POST['name']; | |
$age=$_POST['age']; | |
$target="images/".basename($_FILES['image']['name']); | |
$sql="INSERT INTO image(name,age,image)VALUES('$name','$age','$target')"; | |
$stmt=$con->prepare($sql); | |
$stmt->execute(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>ajax example</title> | |
<link rel="stylesheet" href="bootstrap.css" crossorigin="anonymous"> | |
<!-- Optional theme --> | |
<link rel="stylesheet" href="bootstrap-theme.css" crossorigin="anonymous"> | |
<style> | |
.container{ | |
width:70%; | |
height:30%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id category subcategory_name price | |
1 1 Samsung 10000 | |
2 1 Redmi 12000 | |
3 1 Real Me 10000 | |
4 1 Vivo 12000 | |
5 2 Dell 30000 | |
6 2 Lenovo Ideapad 30000 | |
7 2 Asus 28000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//session_start(); | |
include('connect.php'); | |
if(isset($_POST['submit'])){ | |
for($i=0;$i<count($_POST['slno']);$i++){ | |
$student_name = $_POST['student_name'][$i]; | |
$phone_no = $_POST['phone_no'][$i]; | |
$age = $_POST['age'][$i]; | |
$date_of_birth = $_POST['date_of_birth'][$i]; | |
if($student_name!=='' && $phone_no!=='' && $age!=='' && $date_of_birth!==''){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//session_start(); | |
include('connect.php'); | |
if(isset($_POST['city_name'])) | |
{ | |
$city_name = $_POST['city_name']; | |
$stmt = $con->prepare("select * from pincodes where city_id='$city_name'"); | |
$stmt->execute(); | |
$pin_details = $stmt->fetch(PDO::FETCH_ASSOC); | |
//fetch the value into an array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//session_start(); | |
include('connect.php'); | |
if(isset($_POST['state_name'])) | |
{ | |
$state_name = $_POST['state_name']; | |
$stmt = $con->prepare("select * from city where state_id='$state_name'"); | |
$stmt->execute(); | |
$city_details = $stmt->fetchAll(PDO::FETCH_ASSOC); | |
$option1 = '<select class="form-control" name="city"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include('connect.php'); | |
if(isset($_POST['search'])){ | |
$key = $_POST['search']; | |
$stmt = $con->prepare("select * from users where username like '%$key%' or phone_no like '%$key%'"); | |
$stmt->execute(); | |
$user_details = $stmt->fetch(PDO::FETCH_ASSOC); | |
if($stmt->rowCount()>0) | |
{ | |
$output['success'] = '<table class="table table-bordered"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include '../connect.php'; | |
session_start(); | |
//destroy the session | |
session_unset(); | |
//redirect to login page | |
header("location: login.php"); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
include '../connect.php'; | |
if($_SESSION['username']==''){ | |
header("location: login.php"); | |
} | |
?> | |
<html> | |
<head> | |
<title>ajax example</title> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include '../connect.php'; | |
session_start(); | |
if(isset($_POST['login'])){ | |
$username = $_POST['username']; | |
$password = $_POST['password']; | |
//check login details | |
$stmt = $con->prepare("select * from users where username = '$username' and password = '$password'"); | |
$stmt->execute(); | |
//echo $stmt->rowCount(); |
NewerOlder