SHOW:
|
|
- or go back to the newest paste.
1 | <html> | |
2 | <?php | |
3 | $host="127.0.0.0"; // Host name | |
4 | $username="username"; // Mysql username | |
5 | $password="password"; // Mysql password | |
6 | $db_name="database"; // Database name | |
7 | $tbl_name="table_name"; // Table name | |
8 | ?> | |
9 | - | $("select#type").attr("disabled","disabled"); |
9 | + | |
10 | - | $("select#category").change(function(){ |
10 | + | |
11 | - | $("select#type").attr("disabled","disabled"); |
11 | + | |
12 | - | $("select#type").html("<option>wait...</option>"); |
12 | + | |
13 | - | var id = $("select#category option:selected").attr('value'); |
13 | + | |
14 | - | $.post("select_type.php", {id:id}, function(data){ |
14 | + | |
15 | - | $("select#type").removeAttr("disabled"); |
15 | + | |
16 | - | $("select#type").html(data); |
16 | + | // Load the category from the php. |
17 | var category = <?php echo json_encode($opt->ShowCategory()); ?>; | |
18 | ||
19 | $(document).ready(function(){ | |
20 | $("select#type").attr("disabled","disabled"); | |
21 | $("select#category").change(function(){ | |
22 | $("select#type").attr("disabled","disabled"); | |
23 | $("select#type").html("<option>wait...</option>"); | |
24 | var id = $("select#category option:selected").attr('value'); | |
25 | $.post("select_type.php", {id:id}, function(data){ | |
26 | $("select#type").removeAttr("disabled"); | |
27 | $("select#type").html(data); | |
28 | }); | |
29 | ); | |
30 | }); | |
31 | ||
32 | // Build the select from the json. | |
33 | $.getJSON("category", function (row) { | |
34 | $.each(row.groups, function(index,group) { | |
35 | $("#category").append("<option value='" + row.section_id + "'>" + row.description + "</option>"); | |
36 | } | |
37 | }); | |
38 | ||
39 | $("select#principle").attr("disabled","disabled"); | |
40 | $("select#type").change(function(){ | |
41 | $("select#principle").attr("disabled","disabled"); | |
42 | $("select#principle").html("<option>wait...</option>"); | |
43 | var id = $("select#type option:selected").attr('value'); | |
44 | $.post("select_principle.php", {id:id}, function(data){ | |
45 | $("select#principle").removeAttr("disabled"); | |
46 | $("select#principle").html(data); | |
47 | }); | |
48 | }); | |
49 | ||
50 | $("form#select_form").submit(function(){ | |
51 | var cat = $("select#category option:selected").attr('value'); | |
52 | var type = $("select#type option:selected").attr('value'); | |
53 | var princ = $("select#principle option:selected").attr('value'); | |
54 | if(cat>0 && type>0 && princ>0) | |
55 | { | |
56 | var result = $("select#principle option:selected").html(); | |
57 | $("#result").html('your choice: '+result); | |
58 | } | |
59 | else | |
60 | { | |
61 | $("#result").html("you must choose two options!"); | |
62 | } | |
63 | return false; | |
64 | }); | |
65 | }); | |
66 | </script> | |
67 | <body> | |
68 | ||
69 | ||
70 | ||
71 | <?php | |
72 | session_start(); | |
73 | $_SESSION["username"]; | |
74 | $_SESSION["password"]; | |
75 | $_SESSION["access"]; | |
76 | ?> | |
77 | ||
78 | <div id="Container"> | |
79 | ||
80 | <div id="Header"> | |
81 | ||
82 | <div id="SignIn"> | |
83 | <a href="logout.php">Logout</a> | |
84 | <a href="login.php">Login</a> | |
85 | <a href="index.php">Home</a> | |
86 | </div> | |
87 | ||
88 | <div id="MainNavigationLanding"> | |
89 | <nav> | |
90 | <ul> | |
91 | <li><a href="content.php" id="Kids" ></a></li> | |
92 | <li><a href="content.php" id="Students"></a></li> | |
93 | <li><a href="content.php" id="Business"></a> | |
94 | </li> | |
95 | - | <?php echo $opt->ShowCategory(); ?> |
95 | + | |
96 | </nav> | |
97 | </div><!-- End of the MainNavigation --> | |
98 | </div> <!-- End of the Header --> | |
99 | ||
100 | <div id="Content"> | |
101 | ||
102 | <?php include "select.class.php"; ?> | |
103 | <form id="select_form" > | |
104 | Choose a subject:<br /> | |
105 | <select id="category" > | |
106 | </select> | |
107 | <br /><br /> | |
108 | ||
109 | Choose a section:<br /> | |
110 | <select id="type"> | |
111 | <option value="%">any...</option> | |
112 | </select> | |
113 | <br /><br /> | |
114 | ||
115 | Choose a principle:<br /> | |
116 | <select id="principle"> | |
117 | <option value="%">any...</option> | |
118 | </select> | |
119 | <br /><br /> | |
120 | ||
121 | <input type="submit" value="confirm" /> | |
122 | </form> | |
123 | <div id="result"></div> | |
124 | ||
125 | <!-- end of the Options --> | |
126 | ||
127 | ||
128 | ||
129 | ||
130 | ||
131 | ||
132 | ||
133 | <div id="Results"> | |
134 | <?php | |
135 | $Public = "Please Login in or register an account to be able to see the content"; | |
136 | $Consumer = "Hello you should only see this within a consumer account also known as kids or schools"; | |
137 | $Contributor = " Hello you should only see this text if you are within a contributor account fro example work"; | |
138 | $Admin = " Hello you should only see this when you are logged into and admin account"; | |
139 | ||
140 | if($_SESSION["username"] == ""){ | |
141 | echo $Public; | |
142 | } | |
143 | ||
144 | if($_SESSION["access"] == "Consumer"){ | |
145 | echo $Consumer; | |
146 | ||
147 | echo "<div id=\"Video\">"; | |
148 | echo "<div id=\"VideoImage\">"; | |
149 | echo "this is the video image"; | |
150 | echo "</div>"; | |
151 | echo "<div id=\"VideoDetails\">"; | |
152 | echo "<div id=\"VideoTitle\">"; | |
153 | echo "</div>"; | |
154 | echo "<div id=\"VideoBlurb\">"; | |
155 | echo "this is a video for a maths class made by thomas dudley"; | |
156 | echo "</div>"; | |
157 | echo "<a href=\"index.php\">Download</a>"; | |
158 | echo "</div>"; | |
159 | echo "</div>"; | |
160 | } | |
161 | ||
162 | if($_SESSION["access"] == "Contributor"){ | |
163 | echo $Contributor; | |
164 | ||
165 | echo "<div id=\"Video\">"; | |
166 | echo "<div id=\"VideoImage\">"; | |
167 | echo "this is the video image"; | |
168 | echo "</div>"; | |
169 | echo "<div id=\"VideoDetails\">"; | |
170 | echo "<div id=\"VideoTitle\">"; | |
171 | echo "</div>"; | |
172 | echo "<div id=\"VideoBlurb\">"; | |
173 | echo "this is a video for a maths class made by thomas dudley"; | |
174 | echo "</div>"; | |
175 | echo "<a href=\"index.php\">Download</a>"; | |
176 | echo "</div>"; | |
177 | echo "</div>"; | |
178 | } | |
179 | ||
180 | if($_SESSION["access"] == "Administrator"){ | |
181 | echo $Admin; | |
182 | ||
183 | echo "<div id=\"Video\">"; | |
184 | echo "<div id=\"VideoImage\">"; | |
185 | echo " this is the video image"; | |
186 | echo "</div>"; | |
187 | echo "<div id=\"VideoDetails\">"; | |
188 | echo "<div id=\"VideoTitle\">"; | |
189 | echo "</div>"; | |
190 | echo "<div id=\"VideoBlurb\">"; | |
191 | echo "this is a video for a maths class made by thomas dudley"; | |
192 | echo "</div>"; | |
193 | echo "<a href=\"index.php\">Download</a>"; | |
194 | echo "</div>"; | |
195 | echo "</div>"; | |
196 | } | |
197 | ?> | |
198 | </div> <!-- end of the Results --> | |
199 | ||
200 | </div> <!-- End of the Content --> | |
201 | ||
202 | </div> <!-- End of the Container --> | |
203 | </body> <!-- End of the Body --> | |
204 | </html> <!-- End of the Html --> |