Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

By Lokesh #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions connect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
$con=mysqli_connect("localhost","root","","Test 01/10");
if (!$con)
{
echo "failed";
die("Connection failed: " . mysqli_connect_error());
}
?>
40 changes: 40 additions & 0 deletions delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

</head>
<body>

<br>
<br>
<br>
<?php
include 'connect.php';
?>

<div class="container">
<form action="processdelete.php" method="POST">
<div class="row align-items-center">
<div class="col">


<div class="form-group row">
<label for="inputEmail" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
<input class="form-control form-control-lg" type="Email" class="form-control" id="Email" name="Email" placeholder="Email">
</div>
</div>

</div>
</div>
<button type="submit" class="btn btn-primary id="select" name="Details">Submit</button>
</form>
</div>


</body>
</html>
59 changes: 59 additions & 0 deletions details.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php ?>

<html>
<head>

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>







</head>
<body>

<h1>Details</h1>
<hr>

<br>
<br>
<br>


<br>
<h1>To insert</h1>
<button id="myButton1" class="float-left submit-button">Insert</button>
<script type="text/javascript">
document.getElementById("myButton1").onclick = function () {
location.href = "http://localhost/insert.php";
};
</script>
<br>
<br>
<h1>To select</h1>
<button id="myButton2" class="float-left submit-button" >Select</button>
<script type="text/javascript">
document.getElementById("myButton2").onclick = function () {
location.href = "http://localhost/select.php";
};
</script>
<br>
<br>

<h1>To delete</h1>
<button id="myButton3" class="float-left submit-button" >Delete</button>
<script type="text/javascript">
document.getElementById("myButton3").onclick = function () {
location.href = "http://localhost/delete.php";
};
</script>
<br>


</body>
58 changes: 58 additions & 0 deletions insert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

</head>
<body>

<br>
<br>
<br>

<?php
include 'connect.php';
?>

<div class="container">
<form action="processinsert.php" method="POST">
<div class="row align-items-center">
<div class="col">

<div class="form-group row">
<label for="inputName" class="col-sm-2 col-form-label">Name</label>
<div class="col-sm-10">
<input class="form-control form-control-lg" type="Name" class="form-control" id="Name" name="Name" placeholder="Name">
</div>
</div>


<div class="form-group row">
<label for="inputPhone" class="col-sm-2 col-form-label">Phone</label>
<div class="col-sm-10">
<input class="form-control form-control-lg" type="Phone" class="form-control" id="Phone" name="Phone" placeholder="Phone">
</div>
</div>

<div class="form-group row">
<label for="inputEmail" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
<input class="form-control form-control-lg" type="Email" class="form-control" id="Email" name="Email" placeholder="Email">
</div>
</div>




</div>
</div>
<button type="submit" class="btn btn-primary id="select" name="Details">Submit</button>
</form>
</div>


</body>
</html>
18 changes: 18 additions & 0 deletions processdelete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

$email=$_POST['Email'];

$useremail=stripcslashes($email);

$con=mysqli_connect("localhost","root","","Test 01/10");


$delete = "DELETE FROM Details WHERE Email='$email' ";

if (mysqli_query($con, $delete)) {
echo "Record deleted successfully";
} else {
echo "Error deleting record: " . mysqli_error($con);
}

?>
21 changes: 21 additions & 0 deletions processinsert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

$name=$_POST['Name'];
$phone=$_POST['Phone'];
$email=$_POST['Email'];

$username=stripcslashes($email);
$userphone=stripcslashes($email);
$useremail=stripcslashes($email);

$con=mysqli_connect("localhost","root","","Test 01/10");

$insert = "INSERT INTO Details (Name,Phone,Email) VALUES ('$name', '$phone', 'email')";

if ($con->query($insert) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $insert . "<br>" . $con->error;
}

?>
66 changes: 66 additions & 0 deletions processselect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
</head>
<body>

<?php

$name=$_POST['Name'];

$username=stripcslashes($name);

$con=mysqli_connect("localhost","root","","Test 01/10");

$result=mysqli_query($con,"select * from Details where Name='$name' ")
or die("Failed to query database.mysql_error()");

$row=mysqli_fetch_array($result);
if($row['Name']==$name)
{


echo "<table border='1'>

<tr>

<th>Name</th>

<th>Phone</th>

<th>Email</th>

</tr>";

echo "<tr>";

echo "<td>" . $row['Name'] . "</td>";

echo "<td>" . $row['Phone'] . "</td>";

echo "<td>" . $row['Email'] . "</td>";

echo "</tr>";

echo "</table>";

}
else
{
echo "Not Found!!!";
}

?>

</body>
</html>





84 changes: 84 additions & 0 deletions select.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

</head>
<body>
<br>
<br>
<br>
<?php
include 'connect.php';
$result=mysqli_query($con,"select * from Details")
or die("Failed to query database.mysql_error()");


echo "<table border='1'>

<tr>

<th>Name</th>

<th>Phone</th>

<th>Email</th>

</tr>";



while($row = mysqli_fetch_array($result))

{

echo "<tr>";

echo "<td>" . $row['Name'] . "</td>";

echo "<td>" . $row['Phone'] . "</td>";

echo "<td>" . $row['Email'] . "</td>";

echo "</tr>";

}

echo "</table>";

?>

<br>
<br>
<br>

<div class="container">
<form action="process.php" method="POST">
<div class="row align-items-center">
<div class="col">


<div class="form-group row">
<label for="inputName" class="col-sm-2 col-form-label">Name</label>
<div class="col-sm-10">
<input class="form-control form-control-lg" type="Name" class="form-control" id="Name" name="Name" placeholder="Name">
</div>
</div>

</div>
</div>
<button type="submit" class="btn btn-primary id="select" name="Details">Submit</button>
</form>
</div>

</body>
</html>