/
InsertNewsSource.php
49 lines (37 loc) · 1.24 KB
/
InsertNewsSource.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
<?php
require_once("NewsSourcePDO.php");
require_once("NewsSource.php");
if(isset($_POST['submit']))
{
$newssourcename = $_POST["newssourcename"];
// echo $username . "<br>\n";
$newssourcelink = $_POST["newssourcelink"];
//echo $password ."<br>\n";
$newssourcelinktype = $_POST["newssourcelinktype"];
if($newssourcename !='' && $newssourcelink !='' && $newssourcelinktype != '')
{
$newsSourcePDO = new NewsSourcePDO();
$newsSource = new NewsSource();
$newsSource->setNewsSourceName($newssourcename);
$newsSource->setNewsSourceLink($newssourcelink);
$newsSource->setNewsSourceLinkType($newssourcelinktype);
$newsSourcePDO->insertNewsSource($newsSource);
echo("<html>");
echo("<head>");
echo("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' >");
echo("<link rel='stylesheet' type='text/css' href='menu.css'>");
echo("<title>News Portal - Insert NewsSource</title>");
echo("</head>");
echo("<body>");
include "menu.php";
echo("Created a NewsSource </br>");
echo("<a href='index.php'> Back to Home</a>");
echo("</body>");
echo("</html");
}
else {
echo "Please fill all of the fields" . "<br>\n";
echo("<a href='CreateNewsSource.php'> Back to Create News Source Page</a>");
}
}
?>