-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_rate.php
75 lines (58 loc) · 1.89 KB
/
add_rate.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
64
65
66
67
68
69
70
71
72
73
74
75
<?php
require 'includes/bd.php';
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
//$name = $_POST["name"];
$rating = $_POST["rating"];
$sql = "INSERT INTO rate (rate) VALUES ('$rating')";
if (mysqli_query($con, $sql))
{
//echo "New Rate addedddd successfully";
}
else
{
echo "Error: " . $sql . "<br>" . mysqli_error($con);
}
mysqli_close($con);
}
?>
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.0/css/bootstrap.min.css" integrity="sha384-SI27wrMjH3ZZ89r4o+fGIJtnzkAnFs3E4qz9DIYioCQ5l9Rd/7UAa8DHcaL8jkWt" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/rateYo/2.3.2/jquery.rateyo.min.css">
</head>
<body>
<div class="container">
<div class="row">
</br>
<form action="wishNew.php" method="post">
<div>
<h3> Do you want to evaluate BestTech!?</h3>
</div>
<div class="rateyo" id= "rating"
data-rateyo-rating="4"
data-rateyo-num-stars="5"
data-rateyo-score="3">
</div>
<span class='result'></span>
<input type="hidden" name="rating">
</div>
<div><input class="btn hvr-hover" type="submit" name="add" value="send"> </div>
</form>
</div>
</div>
</br>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rateYo/2.3.2/jquery.rateyo.min.js"></script>
<script>
$(function () {
$(".rateyo").rateYo().on("rateyo.change", function (e, data) {
var rating = data.rating;
$(this).parent().find('.score').text('score :'+ $(this).attr('data-rateyo-score'));
$(this).parent().find('.result').text('rating :'+ rating);
$(this).parent().find('input[name=rating]').val(rating); //add rating value to input field
});
});
</script>
</body>
</html>