~dani.behzi/pfcm/pfcm

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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
	<title>FSUG Movie Manager - Addding new movie</title>
	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
	<meta name="creator" content="Danial Behzadi" />
	<meta HTTP-EQUIV="REFRESH" content="3; url=index.php">
	<link rel="stylesheet" type="text/css" href="css.css" />
</head>

<body>
	<?php
		// Create Connection
		include 'connect.php';
		mysql_select_db("collection", $con);
		
		echo "<table align='center' style='width:65%'>";
		
		if ($_POST[name])
		{		
			$sql="INSERT INTO Movies (Name, Year, Director, Genre, Tags)
			VALUES
			('$_POST[name]','$_POST[year]','$_POST[director]',
			'$_POST[genre]','$_POST[tags]')";
			
			if (!mysql_query($sql,$con))
			{
				die('Error: ' . mysql_error());
			}
			echo "<tr><th>Done!</th></tr>";
			echo "<tr><td><p align='center'>Movie '$_POST[name]' added</p></td></tr>";
		}
		else
		{
			echo "<tr><th>Oops!</th></tr>";
			echo "<tr><td><p>Something went wrong</p></td></tr>";
		}
		echo "<tr><td><p>if you didn't redirected automatically<br />
			<a href='index.php'>click here</a></p></td></tr>";
		echo "</table>";	
		
		mysql_close($con)
	?>
	
</body>

</html>