-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddlink.php
48 lines (46 loc) · 1.11 KB
/
addlink.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<html>
<head>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<?php session_start();
?>
<div class="log">
<a href="index.php" class="common">HOME</a>
<a href="viewLink.php" class="common" >View added link </a>
<a href="index.php" class="common">LOGOUT</a>
<?php
echo "<span class='welcome'> Welcome" . $_SESSION["username"];
?>
</div>
<div>
<form method="POST" action="<?php echo $_SERVER["PHP_SELF"];?>">
<p> Just copy the link and paste below </p>
<input type="text" class="addlink" name="link" required placeholder="www.linkSaver.com"><br>
<p>Enter some description</p>
<input type="text" class="linkDesc" name="desc" placeholder="eg:- study material of java"><br>
<input type="submit" class="submit" value="Add Link">
</form>
</div>
<?php
include 'setup.php';
$link="";
if($_SERVER["REQUEST_METHOD"]=="POST")
{
$link=$_POST["link"];
$desp=$_POST["desc"];
$user=$_SESSION["username"];
$sql="INSERT INTO $user(link,description)
VALUES('$link','$desp')";
if($conn->query($sql)===TRUE)
{
echo "added successfully";
}
else
{
echo "error adding link ".$conn->error;
}
}
?>
</body>
</html>