Skip to content

Commit

Permalink
search added
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulK4102 committed Oct 6, 2023
1 parent 47f3d7d commit bc8da63
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 36 deletions.
2 changes: 1 addition & 1 deletion login.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<head>
<meta charset="UTF-8">
<title>Login form</title>
<link rel="stylesheet" href="Login.css">
<link rel="stylesheet" href="Login.css?">

</head>
<body>
Expand Down
60 changes: 38 additions & 22 deletions text_keep/Text_keep.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@
if (isset($_POST['add'])) {
$heading = $_POST['heading'];
$content = ($_POST['content']);
$abc = "/" . $content . "/";
echo $abc;
$text->insert('data', ['acount_id' => $id, 'heading' => $heading, 'content' => $abc]);
$text->insert('data', ['acount_id' => $id, 'heading' => $heading, 'content' => $content]);
}
if (isset($_GET['delete_id'])) {
$id = $_GET['id'];
$delete_id = $_GET['delete_id'];
$text->delete('data', 'id=' . $delete_id);
// header('location:http://localhost/googlekeep_php/text_keep/Text_Keep.php ?id='.$id);
}
if (isset($_POST['search_item'])) {
$search_item = $_POST['search'];
$search = $text->display1('data', 'heading=' . $search_item);
foreach ($search as $row) {
$id = $row['id'];
$acount_id = $row['acount_id'];
header('location:http://localhost/googlekeep_php/text_keep/searched.php ?id='.$acount_id.'&search_id='.$id );
}
}

?>
Expand Down Expand Up @@ -64,13 +70,6 @@
</ul>
</div>
</nav>
<div class="search-wrapper">
<div class="input-holder">
<input type="text" class="search-input" placeholder="Type to search" />
<button class="search-icon" onclick="searchToggle(this, event);"><span></span></button>
</div>
<span class="close" onclick="searchToggle(this, event);"></span>
</div>
<div class="textspace">
<form action="" method="post">
<div class="input-group mb-3">
Expand All @@ -81,45 +80,62 @@
</div>
<div style="
color: white;
"><h1>OR</h1></div>
<div><label for="myfile">Select a file:</label>
<input type="file" id="myfile" name="myfile"></div>
">
<h1>OR</h1>
</div>
<div class="input-group mb-3" >
<input type="file" id="myfile" name="myfile" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" >
</div>
<button name="add">ADD</button>
</form>
</div>
<div class="search">
<div class="search-wrapper">
<div class="input-holder">
<form action="" method="post">
<input type="text" name="search" class="search-input" placeholder="Type to search" />
<button class="search-icon" name="search_item" onclick="searchToggle(this, event);"><span></span></button>
</div>
<span class="close" onclick="searchToggle(this, event);"></span>
</div>
</div>



<div class="abc" style="
display: flex;
flex-direction: column;
gap: 2rem;
margin-top: 2rem;
">
<?php
$result = $text->display1('data', 'acount_id=' . $id);
foreach ($result as $row) {
$current_id = $row['id'];
$acount_id = $row['acount_id'];
echo $current_id;
?>
<div class="content" style="
margin: 0px 5rem 0px;
border: 2px solid #fff;
border-radius: 1rem;
padding:2rem;">
margin: 0px 5rem 0px;
border: 2px solid #fff;
border-radius: 1rem;
padding:2rem;"
>
<span id="spam"><?php echo $row['heading']; ?></span>
<span><?php echo $row['content'] ?></span>
<a href='Text_keep.php?delete_id=<?php echo $current_id ?>&id=<?php echo $acount_id ?>'><button>DELETE</button></a>
<a class="link-light link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover" style="display: flex;" href='delete.php?delete_id=<?php echo $current_id ?>&id=<?php echo $acount_id ?>' > DELETE </a>
</div>
<?php
}
?>
</div>


<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script><script src="script.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
<script src="script.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>

</html>
</html>

6 changes: 3 additions & 3 deletions text_keep/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public function __construct(){
public function insert($table,$param=array()){
if($this->tableExits($table)){
$table_columns = implode(',',array_keys($param));
$table_value = implode("','",$param);

$sql = "INSERT INTO $table ($table_columns) VALUES ('$table_value')";
$data = implode("','",$param);
$sql = "INSERT INTO $table ($table_columns) VALUES ('$data')";
echo $sql;
if($this->mysqli->query($sql)){
array_push($this->result,$this->mysqli->insert_id);
return true;
Expand Down
11 changes: 11 additions & 0 deletions text_keep/delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
include 'database.php';
if (isset($_GET['delete_id'])) {
$text = new Database();
$id = $_GET['id'];
$delete_id = $_GET['delete_id'];
$text->delete('data', 'id=' . $delete_id);
header('location:http://localhost/googlekeep_php/text_keep/Text_keep.php ?id='.$id);
}

?>
146 changes: 146 additions & 0 deletions text_keep/searched.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?php
include 'database.php';
$text = new Database();
$registered_id = $_GET['id'];
$register = $text->display1('register', 'id=' . $registered_id);
if (isset($_POST['add'])) {
$heading = $_POST['heading'];
$content = ($_POST['content']);
$text->insert('data', ['acount_id' => $registered_id, 'heading' => $heading, 'content' => $content]);
}
if (isset($_GET['delete_id'])) {
$id = $_GET['id'];
$delete_id = $_GET['delete_id'];
$text->delete('data', 'id=' . $delete_id);
}

?>


<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="text.css">
<title>Text Keep</title>
</head>

<body>
<nav class="navbar navbar-light" style="background-color: #e3f2fd;">
<a class="navbar-brand" href="#">Text Keep</a>
<?php
if (isset($_GET['id'])) {
foreach ($register as $row) {
?>
<a class="navbar-brand" style="background: #E3F2FD" href="../login.php"><?php echo $row['name'] ?></a>
<?php
}
}
?>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">

<ul class="navbar-nav d-flex p-2">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
</div>
</nav>
<div class="textspace">
<form action="" method="post">
<div class="input-group mb-3">
<input name="heading" type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" placeholder="HEADING">
</div>
<div class="input-group mb-3">
<textarea name="content" id="" cols="100" rows="5" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default"></textarea>
</div>
<div style="
color: white;
">
<h1>OR</h1>
</div>
<div class="input-group mb-3" >
<input type="file" id="myfile" name="myfile" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" >
</div>
<button name="add">ADD</button>
</form>
</div>
<div class="search">
<div class="search-wrapper">
<div class="input-holder">
<form action="" method="post">
<input type="text" name="search" class="search-input" placeholder="Type to search" />
<button class="search-icon" name="search_item" onclick="searchToggle(this, event);"><span></span></button>
</div>
<span class="close" onclick="searchToggle(this, event);"></span>
</div>
</div>



<?php
if(isset($_GET['search_id'])){
$search_id = $_GET['search_id'];
$id = $_GET['id'];
?>
<div class="abc" style="
display: flex;
flex-direction: column;
gap: 2rem;
margin-top: 2rem;
">
<?php
$result = $text->display1('data', 'acount_id=' . $id.' AND id=' . $search_id);
foreach ($result as $row) {
$current_id = $row['id'];
$acount_id = $row['acount_id'];
?>
<div class="content" style="
margin: 0px 5rem 0px;
border: 2px solid #fff;
border-radius: 1rem;
padding:2rem;"
>
<span id="spam"><?php echo $row['heading']; ?></span>
<span><?php echo $row['content'] ?></span>
<a href='Text_keep.php?delete_id=<?php echo $current_id ?>&id=<?php echo $acount_id ?>'><button>DELETE</button></a>
</div>
<?php
}
?>
</div>
<?php
}
?>
</div>


<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
<script src="script.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>

</html>






18 changes: 8 additions & 10 deletions text_keep/text.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,39 @@ body {

#spam {
display: block;
color: #BEFFF7;
color: black;
font-size: 23px;
}

span {
color: rgb(255, 0, 0);
color: white;
}

.abc {
display: flex;
color: red;
color: white;
}

.content {
border: 2px solid #fff;
border-radius: 2rem;
}




::selection {
background: #212129;
}

.search-wrapper {
position: absolute;
transform: translate(-50%, -50%);
top: 50%;
top: 27.2rem;
left: 50%;
}

.search-wrapper.active {}

.search-wrapper .input-holder {
height: 70px;
height: 63px;
width: 70px;
overflow: hidden;
background: rgba(255, 255, 255, 0);
Expand Down Expand Up @@ -102,8 +100,8 @@ span {
}

.search-wrapper .input-holder .search-icon {
width: 70px;
height: 70px;
width: 60px;
height: 60px;
border: none;
border-radius: 6px;
background: #FFF;
Expand Down

0 comments on commit bc8da63

Please sign in to comment.