-
Notifications
You must be signed in to change notification settings - Fork 0
/
newrequest.php
45 lines (45 loc) · 1.54 KB
/
newrequest.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
<?php include("header.php"); ?>
<?php include("connection.php"); ?>
<?php
if(isset($_POST["submit"])){
$sql="select max(rid) from request";
$result=mysqli_query($conn,$sql);
$mrow=mysqli_fetch_array($result);
$mrow=$mrow["max(rid)"]+1;
$pid=$_POST["pid"];
$cid=$_SESSION["cid"];
$size=$_POST["size"];
$desc=$_POST["note"];
$mat=$_POST["material"];
$date=date("Y-m-d");
echo "Today is " . $date . "<br>";
$sql="insert into request values($mrow,$pid,$cid,'$size','$mat','$date','$desc')";
mysqli_query($conn,$sql);
$sql="select email from customer where cid=$cid";
$result=mysqli_query($conn,$sql);
$row=mysqli_fetch_array($result);
$email=$row[0];
$subject="Thank You For Your Request";
$message="<h1>Your order has been noted</h1><br>
Your Request Id is $mrow<br>
Your Requested Product Id is $pid<br>
Your Requested Size is $size<br>
Your Requested material is $mat<br><br>
Request Dated:$date<br>
This is an automated message<br>
Our team will get in contact with you soon
";
$subjectadmin="You have a new Request";
$messageadmin="<h1>a new order has been noted</h1><br>
Customer Id is $cid<br>
Request Id is $mrow<br>
Requested Product Id is $pid<br>
Requested Size is $size<br>
Requested material is $mat<br><br>
Request Dated:$date<br>
";
sendamail($email,$subject,$message);
//sendamail($email,$subjectadmin,$messageadmin);
Redirect("product.php?pid=$pid&redirect=requestsuccess");
}
?>