Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="WordPress/calculation.php">
- <input type="text" name="year">
- <select name="teacher">
- <option value='0' default>Все</option>
- <?php
- $teachers = $wpdb->get_results("SELECT * FROM wp_users;");
- foreach ($teachers as $teacher) {
- echo "<option value='".$teacher->id."'>".$teacher->last_name."</option>";
- }
- ?>
- </select>
- <submit value='Посчитать'>
- </form>
- calculation.php
- <table>
- <?php
- $year = htmlspecialchars(trim($_POST["year"]);
- $teacher = htmlspecialchars(trim($_POST["teacher"]);
- if ($teacher == "") {
- $teachers = $wpdb->get_results("SELECT * FROM wp_users;");
- foreach ($teachers as $teacher) {
- $articles = $wpdb->get_results("SELECT * FROM wp_articles_for_pps ".
- "WHERE id_prepod='$teacher' AND year='$year';");
- $value = 0;
- foreach ($articles as $article) {
- $indicator = $wpdb->get_row("SELECT * FROM wp_indicators ".
- "WHERE id_index='$article->id_index';");
- $value = $value + $indicator->coefficient*$article->amount;
- }
- echo "<tr>"
- echo "<td>$teacher->last_name</td>";
- echo "<td>$value</td>";
- echo "</tr>"
- }
- } else {
- }
- ?>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement