/
index.php
72 lines (63 loc) · 1.89 KB
/
index.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<form method="post" name="search" >
<title>Schema Creator</title>
</head>
<?php
$message = NULL;
function __autoload($class_name) {
include $class_name . '.php';
}
if (empty($_POST["name"]) && empty($_POST["description"]) && empty($_POST["image"]) && empty($_POST["url"]))
{
echo 'Please Enter Recipe Name and Hit Search.' ;
}
else
{
$thing=new Recipe();
/*Collect search parameters and pass to recipe class*/
if(!empty($_POST["name"]))
{
$srchcriteria=array("name"=>$_POST["name"]);
}
if(!empty($_POST["description"]))
{
$srchcriteria=array("description"=>$_POST["description"]);
}
if(!empty($_POST["name"]) && !empty($_POST["description"]))
{
$srchcriteria=array("name"=>$_POST["name"],"description"=>$_POST["description"]);
}
$result=$thing->SearchRecipe($srchcriteria);
if($result==0)
{
$message="Recipe does not exist";
}
}
?>
<body>
<div style="border-style: outset; width: 450px" align="left">
<h2 style="color: red" align="center">Welcome to Recipe System</h2>
<h4 align="center"><label id=questionLabel ><? echo $message; ?></label></h4>
<?php
ini_set("display_errors", "On");
$thing = new Thing();
$form = new FormGenerator();
$form->generate($thing);
?>
<input type="submit" name="Check" title="Check" value="Search Recipe"/>
<h4>
<a href='Add.php'>Add</a>
</h4>
<h4>
<a href='UpdateRecipe.php'>Update</a>
</h4>
<h4>
<a href='DeleteRecipe.php'>Delete</a>
</h4>
</div>
</body>
</form>
</html>