Skip to content

Instantly share code, notes, and snippets.

@imranhoshain
Created November 10, 2016 06:32
Show Gist options
  • Save imranhoshain/063602d083ba1ca93fdde0ae07dad49f to your computer and use it in GitHub Desktop.
Save imranhoshain/063602d083ba1ca93fdde0ae07dad49f to your computer and use it in GitHub Desktop.
New
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Nov 09, 2016 at 05:06 PM
-- Server version: 10.1.16-MariaDB
-- PHP Version: 7.0.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `imran`
--
-- --------------------------------------------------------
--
-- Table structure for table `info`
--
CREATE TABLE `info` (
`Name` varchar(50) NOT NULL,
`Department` varchar(20) NOT NULL,
`Semester` varchar(25) NOT NULL,
`Shift` varchar(20) NOT NULL,
`Phone` int(14) NOT NULL,
`Email` varchar(70) NOT NULL,
`Address` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
<html>
<body>
<body bgcolor ="pink">
<center>
<h1> Students Information </h1>
</center>
<form action ="save.php" method ="POST">
<br> <br>
<center>
<pre>
Name : <input type ="text" name ="Name"> <br>
Department : <input type ="text" name ="Department"> <br>
Semester : <input type ="text" name ="Semester"> <br>
Shift : <input type ="text" name ="Shift"> <br>
Phone : <input type ="text" name ="Phone"> <br>
Email : <input type ="text" name ="Email"> <br>
Address : <input type ="text" name ="Address"> <br>
<input type="file" name ="Image">
<input type ="submit" value ="save"> <input type ="reset" value ="clear"> <br>
</pre>
</center>
</body>
</html>
<?php
$dns = 'mysql:dbname=imran;host=127.0.0.1';
try{$dbconn = new PDO($dns, 'root');
echo 'Success!';
}
catch(PDOException $e){
echo 'Abar thik koro';
}
$a=($_POST['Name']);
$b=($_POST['Department']);
$c=($_POST['Semester']);
$d=($_POST['Shift']);
$e=($_POST['Phone']);
$f=($_POST['Email']);
$g=($_POST['Address']);
$sql ="insert into info(Name,Department,Semester,Shift,Phone,Email,Address) values('$a','$b','$c','$d','$e','$f','$g')";
if(mysqli_query($dns, $sql)){
echo "Records added successfully.";
} else{
echo "ERROR: Could not able to execute $sql. "
. mysqli_error($dns);
}
// Close connection
mysqli_close($dns);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment