-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubmit_process_property.php
63 lines (42 loc) · 1.55 KB
/
submit_process_property.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
58
59
60
61
62
63
<?php
include_once('config/functions.php');
if(isset($_POST['submitBtn'])){
$dataAds = [
'title'=> $_POST['title'],
'description'=> $_POST['description'],
'price'=> $_POST['price'],
'public_status'=> $_POST['public_status'],
'status'=> 1,
'ad_type_id'=> 1,
];
$insertAndGetID = insertRowAndGetID('ads',$dataAds);
if(!empty($_POST['amenity_id'])){
$dataAmenities = transformArrayAmenity($_POST['amenity_id'],$insertAndGetID);
insertRowsIntoDatabase('ad_amenties',$dataAmenities);
}
$arrayMeta = [
'property_type'=> $_POST['property_type'],
'area'=> $_POST['area'],
'bedrooms'=> $_POST['bedrooms'],
'bathrooms'=> $_POST['bathrooms'],
'address'=> $_POST['address'],
'city'=> $_POST['city'],
'state'=> $_POST['state'],
'zip_code'=> $_POST['zip_code'],
'billing_age'=> $_POST['billing_age'],
'garage'=> $_POST['garage'],
'rooms'=> $_POST['rooms'],
'contact_name'=> $_POST['contact_name'],
'email'=> $_POST['email'],
];
$dataMeta = transformArrayMetaKey($arrayMeta,$insertAndGetID);
insertRowsIntoDatabase('ads_meta',$dataMeta);
if(!empty($_FILES['images']) && !empty($_FILES['images']['name'][0])){
$filesInfo = uploadMultipleFiles($_FILES['images'],"uploads/images/ads/",$insertAndGetID);
insertRowsIntoDatabase('ads_images',$filesInfo);
}
redirect('post-ad');
}else{
dd("Unauthorized");
}
?>