-
Notifications
You must be signed in to change notification settings - Fork 0
/
createPost.php
33 lines (30 loc) · 936 Bytes
/
createPost.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
<?php
session_start();
function redirect($url, $statusCode = 303)
{
header('Location: ' . $url, true, $statusCode);
die();
}
$servername='localhost:8091';
$user='root';
$pass='';
$dbname='projecthub';
$conn=new mysqli('localhost',$user,$pass,$dbname) or die("Connection failed");
//check connection if we can connect to the database or not
if($conn->connect_error)
{
die("Connection failed:".$conn->connect_error);
}
$UniId = $_SESSION["unid"];
//$id=$_GET["id"];
$proTitles=$_REQUEST["project-title"];
$cat=$_REQUEST["project-topic"];
$des=$_REQUEST["project-description"];
$run=$_REQUEST["project-status"];
$date=$_REQUEST["start-date"];
$sql="INSERT INTO project VALUES('?','".$UniId."','".$proTitles."','".$run."','".$date."','".$cat."','".$des."',1)";
$result = $conn->query($sql);
//echo "abc";
redirect('http://localhost/ProjectHub-Master/landing.php?id=1');
$conn->close();
?>