-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathissues.php
More file actions
120 lines (112 loc) · 4.63 KB
/
Copy pathissues.php
File metadata and controls
120 lines (112 loc) · 4.63 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
include('partials/_header.php');
// get the category id and model id from the url
if (isset($_GET['category_id'])) {
// get the model id
$category_id = $_GET['category_id'];
// get all the details from tbl_model from db
$sql = "SELECT * FROM `tbl_category` WHERE id = $category_id";
// execute the query
$result = mysqli_query($conn, $sql);
if ($result) {
// query executed
$row = mysqli_fetch_assoc($result);
$category_title = $row['title'];
}
} else {
// if failed to get the id redirect the user to categories
header('location:' . SITEURL . 'categories.php');
die();
}
if (isset($_GET['model_id'])) {
// get the model id
$model_id = $_GET['model_id'];
// get all the details from tbl_model from db
$sql2 = "SELECT * FROM `tbl_model` WHERE id = $model_id";
// execute the query
$result2 = mysqli_query($conn, $sql2);
if ($result2 == true) {
// query executed
$row2 = mysqli_fetch_assoc($result2);
$model_title = $row2['title'];
$image_name = $row2['image_name'];
}
} else {
// if failed to get the id redirect the user to categories
header('location:' . SITEURL . 'categories.php');
die();
}
?>
<form action="<?php echo SITEURL; ?>order.php" method="POST">
<div class="p-5 mb-4 bg-light rounded-3">
<div class="container-fluid py-5">
<div class="row">
<div class="col-md-6 text-center">
<img class="mb-3" src="<?php echo SITEURL; ?>images/model/<?php echo $image_name; ?>" alt="">
<div>
<h6 class="display-6 fw-normal mb-3"><?php echo $model_title; ?></h6>
<div class="mb-3 d-flex align-items-center justify-content-center">
<label for="color" class="form-label text-muted mb-0" style="font-size: 20px; ">Pick Your Device color</label>
<input style="margin: 0px 15px;width: 60px;" name="color" type="color" class="form-control form-control-color" id="color">
</div>
</div>
</div>
<div class="col-md-6 ">
<h4 class="mb-3">Select one of your mobile issue your facing</h4>
<div class="input-group mb-3 ">
<label class="input-group-text" for="inputGroupSelect01">Options</label>
<select required class="form-select" name="issue_select" id="inputGroupSelect01">
<option selected>Select your issue here</option>
<?php
// Create PHP Code to Display issues from database
// 1. Create a SQL query to get all active issues from database
$sql = "SELECT * FROM tbl_issue WHERE active='Yes'";
// Execute the query
$result = mysqli_query($conn, $sql);
// Count Rows to check whether we have issues
$count = mysqli_num_rows($result);
// If count is greater than zero we have issues else we don't have issues
if ($count > 0) {
// We have issues
while ($row = mysqli_fetch_assoc($result)) {
// get the details of issues
$issue_id = $row['id'];
$issues = $row['issues'];
?>
<option value="<?php echo $issue_id; ?>"><?php echo $issues; ?></option>
<?php
}
} else {
// We don't have issues
?>
<option value="0">No Issues model</option>
<?php
}
?>
</select>
</div>
<div class="mb-3">
<label for="issue_desc" class="mb-3 text-muted">Give me some more details or other issues your facing </label>
<textarea name="issue_desc" placeholder="Tell me More About Your Issue..." id="issue_desc" cols="20" rows="5" class="w-100 p-3 shadow-sm" style="resize: none; border-radius:5px;"></textarea>
</div>
<div class="d-grid gap-2 col-6 mx-auto w-100">
<p class="text-muted">Note: <small><em>*Our Team Will Contact You</em></small></p>
<button name="submit" class="btn btn-primary b-btn" type="submit">Book Now</button>
<?php
session_start();
$_SESSION['issue_select'] = mysqli_real_escape_string($conn, $_POST['issue_select']);
$_SESSION['issue_desc'] = mysqli_real_escape_string($conn, $_POST['issue_desc']);
$_SESSION['color'] = mysqli_real_escape_string($conn,$_POST['color']);
$_SESSION['category_title'] = $category_title;
$_SESSION['model_title'] = $model_title;
?>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Footer page included -->
<?php
include('partials/_footer.php');
?>