-
Notifications
You must be signed in to change notification settings - Fork 0
/
processWantServices.php
57 lines (47 loc) · 1.62 KB
/
processWantServices.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
49
50
51
52
53
54
55
56
57
<?php
session_start();
require_once "configuration.php";
//require_once "header.php";
require_once $ROOT_PATH."administrator/utility/crud.php";
require_once $ROOT_PATH."administrator/utility/idEncode.php";
$serviceid = $_POST['cmbWServicesReq'];
$uid = $_SESSION['userid'];
$description = $_POST['txtWSDESC'];
$date = date('Y-m-d');
$finalDate = $_POST['MyDate1'];
if(!$serviceid || !$finalDate)
{
$_SESSION['message'] = "Please fill up all the fields";
header("location:wantServices.php");
}
else if($finalDate<$date)
{
$_SESSION['message'] = "Please enter valid date";
header("location:wantServices.php");
}
else
{
require_once("connect.php");
$sql = "SELECT userDetailsID FROM userdetails WHERE userID = '".$uid."';";
//echo $sql;
$res = mysqli_query($con,$sql);
$rec = mysqli_fetch_array($res);
$ucID = $rec['userDetailsID'];
$_SESSION['userDeatailsID'] = $ucID;
$sql = "INSERT INTO needyservices(userDetailsID,servicesID,date,needyServiceDescription,postedDate) VALUES($ucID,$serviceid,'$finalDate','$description','$date');";
echo $sql;
if(!mysqli_query($con,$sql))
{
mysqli_close($con);
$_SESSION['message'] = $_SESSION['userDeatailsID'];
header("location:wantServices.php");
}
else
{
mysqli_close($con);
//$_SESSION['message'] = "Thank you for providing service..:)";
//header("location:wantServices.php");
header("Location: serviceDetail.php?id=".$_POST['cmbWServicesReq']);
}
}
?>