/
addsource.php
65 lines (58 loc) · 1.61 KB
/
addsource.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
<?php
include("dbconnect.php");
include('functions.php');
checkright("addsource");
include('i_header.php');
?>
<!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>
<link rel="stylesheet" href="style_01.css" type="text/css" rev="stylesheet" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GFS</title>
</head>
<td align="center"><div id='campus'>
<?php
if(isset($_POST['addsource']))
{
$q = mysql_query("INSERT INTO source SET source='$_POST[source]'");
if(!$q)
{
echo mysql_error();
}
else
{
echo "<h3>Source : ".$_POST['source']." added sucessfully.</h3>";
}
}
?>
<form action="addsource.php" method="post">
Enter Source Name : <input type="text" name="source" /><input type="submit" name="addsource" value="Add Source" />
</form>
<br /><br />
<table width="400" border="2" cellpadding="10" cellspacing="0">
<tr><td colspan="3" align="center">List of Added Sources:</td></tr>
<tr><td>SNo.</td><td>Source</td><td>Total Entries</td></tr>
<?php
$source = mysql_query("SELECT * FROM source");
$s =1;
while($sourcearray = mysql_fetch_array($source))
{
?>
<tr><td><?php echo $s;?></td><td><?php echo $sourcearray['source'];?></td>
<td>
<?php
$query = mysql_query("SELECT * FROM details WHERE source='$sourcearray[source]'");
echo mysql_num_rows($query);
?>
</td></tr>
<?php
$s++;}
?>
</table>
</div></td></tr>
</table>
<?php include("i_footer.php"); ?>
</div>
</body>
</html>