-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmidterm_2.php
110 lines (105 loc) · 3.24 KB
/
midterm_2.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php include_once ('printable.php');
/*
,'``.._ ,'``.
:,--._:)\,:,._,.: All Glory to
:`--,'' :`...';\ the HYPNO TOAD!
`,' `---' `.
/ :
/ \
,' :\.___,-.
`...,---'``````-..._ |: \
( ) ;: ) \ _,-.
`. ( // `' \
: `.// ) ) , ;
,-|`. _,'/ ) ) ,' ,'
( :`.`-..____..=:.-': . _,' ,'
`,'\ ``--....-)=' `._, \ ,') _ '``._
_.-/ _ `. (_) / )' ; / \ \`-.'
`--( `-:`. `' ___..' _,-' |/ `.)
`-. `.`.``-----``--, .'
|/`.\`' ,','); SSt
` (/ (/
*/
?>
<?php
define('EOL',"<br />\n"); // defining my constants
$bg_color = array('white' => '#ffffff', 'black' => '#000000', 'grey' => '#cccccc', 'steel blue' => '#236B8E', 'light-grey' => 'hex=#A8A8A8');
$font_fam = array('serif', 'sans-serif', 'fantasy', 'monospace');
$font_size = array('normal' => '100%', 'tiny' => '40%', 'large' => '150%', 'extra-large' => '200%', 'medium' => '60%');
?>
<!DOCTYPE HTML>
<html lang=en-us>
<head>
<meta charset=utf-8>
<title>Midterm Example</title>
<style type="text/css">
.container {
width:640px;
margin:0 auto;
text-align: center;
background-color: #06A2CB;
color: #DD1E2F;
}
footer {
text-align: center;
color: #DD1E2F;
font-family: monospace;
}
</style>
</head>
<body bgcolor="<?=isset($_POST['colors'])?$_POST['colors'][0]:''?>" style="font-family:<?=isset($_POST['font'])?$_POST['font'][0]:''?>; font-size:<?=isset($_POST['size'])?$_POST['size'][0]:''?>">
<div class="container">
<section>
<h1>Midterm Exam</h1>
</section>
<section>
<?php
print_r($_POST);
// change background color
echo '<h3>Select the background color</h3>';
echo '<form name="submit" method="post">';
echo '<select name="colors[]">';
foreach($bg_color as $vals => $hex) {
echo '<option value="';
echo $hex;
echo '">';
echo $vals;
echo '</option>';
}
echo '</select>';
// Change font family
echo '<h3>Select the font family</h3>';
echo '<form name="submit" method="post">';
echo '<select name="font[]">';
foreach($font_fam as $font) {
echo '<option value="';
echo $font;
echo '">';
echo $font;
echo '</option>';
}
echo '</select>';
// Change font size
// Change font family
echo '<h3>Select the font size</h3>';
echo '<form name="submit" method="post">';
echo '<select name="size[]">';
foreach($font_size as $value => $size) {
echo '<option value="';
echo $size;
echo '">';
echo $value;
echo '</option>';
}
echo '</select>';
echo EOL;
echo EOL;
echo '<input type="submit" value="Change" />';
echo '</form>';
?>
</section>
</div>
<footer>
<p>© Kia Lam 2013</p>
</footer>
</body>