-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
86 lines (78 loc) · 2.77 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
include 'assets/include.php';
require './assets/dbInfo.php';
$query = "SELECT id, first_name, last_name, pen_name FROM Author ORDER BY first_name";
$resultObj = $connection->query($query);
if(count($_POST) > 0)
{
if($_POST['email'] != '')
{
$_SESSION['formPostData'] = $_POST;
header('Location: final.php');
}
else
{
$emailError = 'validation';
}
}
?>
<!DOCTYPE html>
<html >
<head>
<title>PHP Fundamentals</title>
<link href="assets/styles.css" rel="stylesheet" type="text/css" />
<link rel="icon" href="assets/mail.png">
</head>
<body >
<div id="Header">
<img src="assets/mail.png" border="0" alt="">
<h2>
Join Our Literature Mailing List
</h2>
</div>
<div id="Body">
<form method="post" action="index.php" >
<div>
<label>Favorite Author:</label>
<select name="author">
<?php while($row = $resultObj->fetch_assoc()): ?>
<option value="<?=$row['first_name']?> <?=$row['last_name']?>">
<?=$row['first_name']?> <?=$row['last_name']?></option>
<?php endWhile; ?>
</select>
</div>
<div class="multiple">
<label>Favorite Century:</label>
17th Century <input type="checkbox" name="century[]" value="17th">
18th Century <input type="checkbox" name="century[]" value="18th">
19th Century <input type="checkbox" name="century[]" value="19th">
</div>
<div>
<label>Comments:</label>
<textarea name="comments"></textarea>
</div>
<div>
<label>Name:</label>
<input type="text" name="name" />
</div>
<div class="<?=$emailError?>">
<label>E-mail Address:</label>
<input type="text" name="email" />
</div>
<div class="multiple">
<label>Receive Newsletter:</label>
Yes <input type="radio" name="newsletter" value="YES">
No <input type="radio" name="newsletter" value="NO">
</div>
<div class="multiple">
<label> </label>
<input type="submit" name="submit" value="Join Mailing List">
</div>
</form>
</div>
</body>
</html>
<?php
$resultObj->close();
$connection->close();
?>