-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.php
38 lines (25 loc) · 927 Bytes
/
edit.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
<?php include_once 'config/init.php'; ?>
<?php
$job = new Job();
$job_id = isset($_GET['id']) ? $_GET['id'] : null;
if(isset($_POST['submit'])){
// Create data array
$data = array();
$data['job_title'] = $_POST['job_title'];
$data['company'] = $_POST['company'];
$data['category_id'] = $_POST['category'];
$data['description'] = $_POST['description'];
$data['location'] = $_POST['location'];
$data['salary'] = $_POST['salary'];
$data['contact_user'] = $_POST['contact_user'];
$data['contact_email'] = $_POST['contact_email'];
if($job->update($job_id, $data)){
redirect('index.php', 'Your job has been listed', 'success');
}else{
redirect('index.php', 'Something went wrong', 'error');
}
}
$template = new Template('templates/job-create.php');
$template->job = $job->getJob($job_id);
$template->categories = $job->getCategories();
echo $template;