-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit-request.php
53 lines (50 loc) · 1.5 KB
/
submit-request.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
<?php session_start(); ?>
<?php
require 'php/includes/dbcon.php';
$target_dir = "images/request/";
$target_file = $target_dir . basename($_FILES["coverphoto"]["name"]);
if (isset($_FILES["coverphoto"])){
if (move_uploaded_file($_FILES["coverphoto"]["tmp_name"], $target_file)){
// echo "The file ".basename($_FILES["coverphoto"]["name"])." is uploaded";
}
else {
echo "Error while uploading your file.";
}
}
else {
echo "File not available";
}
$title=$_POST["title"];
$location=$_POST["location"];
$description=$_POST["description"];
$city=$_POST["city"];
$district=$_POST["district"];
$province=$_POST["province"];
$max_price=$_POST["max_price"];
$min_price=$_POST["min_price"];
$max_area=$_POST["max_area"];
$min_area=$_POST["min_area"];
$distance=$_POST["distance"];
$type_id=$_POST["postType"];
$user_id=$_SESSION['user_id'];
$sql="INSERT INTO request(title,location,description,city,district,province,max_price,min_price,max_area,min_area,distance,cover_photo,type_id,user_id) VALUES('$title','$location','$description','$city','$district','$province','$max_price','$min_price','$max_area','$min_area','$distance','$target_file','$type_id','$user_id')";
if($con->query($sql))
{
echo "<script>alert('Form Submitted Successfully');</script>";
if($type_id==2)
{
header("Location:payment.php");
}
else if($type_id==3)
{
header("Location:payment.php");
}
else{
header("Location:index.php");
}
}
else
{
echo "Error: ".$con->error;
}
?>