-
Notifications
You must be signed in to change notification settings - Fork 0
/
nextpage.php
110 lines (93 loc) · 2.47 KB
/
nextpage.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
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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="HomeCSS.css">
<title></title>
</head>
<body>
<?php require 'header.php'; ?>
</body>
</html>
<style type="text/css">
#box {
margin-bottom: -13%;
}
#dataPrint {
text-align: justify;
font-family: verdana;
font-size: 20px;
border: 1px solid black;
margin: 1%;
padding: 2%;
width: 60%;
}
#imgPrint {
border: 20px solid grey;
margin-right: 1%;
padding: 2%;
width: 22%;
transform: translate(240%, -125%);
}
#namePrint {
color: red;
font-size: 30px;
}
</style>
<?php
ini_set('display_errors', 'Off');
if($_POST['ingredients'] == null )
{
echo "Please select ingredients";
}
else
{
$flag = 0;
$ing = null;
echo "<p style='color: blue; font-size: 30px; font-family : serif; margin-left:2%; '>";
echo "Ingredients : ";
foreach($_POST['ingredients'] as $ingredeance){
$ing = $ingredeance;
echo $ing.", ";
}
echo "</p><br><br>";
foreach($_POST['ingredients'] as $ingredeance){
$ing = $ingredeance;
echo "</p>";
echo "<br><br>";
if (($handle = fopen("clean_recipes.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 2000, ";")) !== FALSE) {
$num = count($data);
if(strpos($data[7], $ing)) {
$row++;
echo "<div id='box'>";
echo "<div id='dataPrint'>";
echo "<b id='namePrint'>".$data[0]."</b><br><br>";
echo "<b>Prepare time : </b>".$data[4]."<br>";
echo "<b>Cook time : </b>".$data[5]."<br>";
echo "<b>Total time : </b>".$data[6]."<br>";
echo "<b>Ingredients : </b><br>".$data[7]."<br><br>";
echo "<b>Direction : </b>";
$ttt = "$data[8]";
echo nl2br($ttt);
echo "</div>";
echo "<div id = 'imgPrint'>";
echo "<img src=".$data[2]." height='180px' width = '280px'><br>";
echo "</div>";
echo "</div>";
$flag = 1;
}
if ($row === 5) {
break 2;
}
}
}
fclose($handle);
}
if($row == 0 || $flag == 0) {
echo "<div id='dataPrint'>";
echo "<b id='namePrint'>";
echo "Sorry We didn't find any Recipes from these ingredients!";
echo "</b></div>";
}
}
?>