Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Ach ja, wehe ihr Kopiert das !!!!!
- if(preg_match('/MSIE/i',$_SERVER['HTTP_USER_AGENT']) && !preg_match('/Opera/i',$_SERVER['HTTP_USER_AGENT']))
- {
- echo "GOD ONTIME SAID: GOOOO AWWWAYYY YOU **** IE USER !";
- }
- MYSQL_CONNECT("localhost", "root", "");
- MYSQL_SELECT_DB("pfanzliste");
- echo mysql_error();
- if(!isset($_POST["create"])) {
- if(isset($_POST["id"]) && isset($_POST["standort"]) && isset($_POST["pflanzeit"]) && isset($_POST["pflanzdatum"])) {
- if(isset($_POST["bemerkung"]) && isset($_POST["erntedatum"]) && isset($_POST["bewertungvAndreas"])) {
- if(isset($_POST["bewertungvSahra"]) && isset($_POST["bewertungvBernd"]) && isset($_POST["bewertungvTom"]) && isset($_POST["bewertungvPeter"])) {
- if(isset($_POST["bewertungvIna"]) && isset($_POST["bewertungvJohn"]) && isset($_POST["bewertungvIrene"])) {
- $id = $_POST["id"];
- MYSQL_QUERY("UPDATE `pflanzliste` SET standort = '" . $_POST["standort"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET pflanzeit = '" . $_POST["pflanzeit"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET pflanzdatum = '" . $_POST["pflanzdatum"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET bemerkung = '" . $_POST["bemerkung"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET erntedatum = '" . $_POST["erntedatum"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET bewertungvAndreas = '" . $_POST["bewertungvAndreas"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET bewertungvSahra = '" . $_POST["bewertungvSahra"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET bewertungvBernd = '" . $_POST["bewertungvBernd"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET bewertungvTom = '" . $_POST["bewertungvTom"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET bewertungvPeter = '" . $_POST["bewertungvPeter"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET bewertungvIna = '" . $_POST["bewertungvIna"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET bewertungvJohn = '" . $_POST["bewertungvJohn"] . "' WHERE id = '$id'");
- MYSQL_QUERY("UPDATE `pflanzliste` SET bewertungvIrene = '" . $_POST["bewertungvIrene"] . "' WHERE id = '$id'");
- }
- }
- }
- }
- } else {
- $do = "SELECT * FROM `pfanzliste`.`pflanzliste`";
- $result = MYSQL_QUERY($do);
- $id = 0;
- while ($row = MYSQL_FETCH_ROW($result)) { $id++; }
- $id = $id+1;
- $standort = $_POST["standort"];
- $pflanzeit = $_POST["pflanzeit"];
- $pflanzdatum = $_POST["pflanzdatum"];
- $bemerkung = $_POST["bemerkung"];
- $erntedatum = $_POST["erntedatum"];
- $bewertungvAndreas = $_POST["bewertungvAndreas"];
- $bewertungvSahra = $_POST["bewertungvSahra"];
- $bewertungvBernd = $_POST["bewertungvBernd"];
- $bewertungvTom = $_POST["bewertungvTom"];
- $bewertungvPeter = $_POST["bewertungvPeter"];
- $bewertungvIna = $_POST["bewertungvIna"];
- $bewertungvJohn = $_POST["bewertungvJohn"];
- $bewertungvIrene = $_POST["bewertungvIrene"];
- MYSQL_QUERY("INSERT INTO pflanzliste (
- id,
- standort,
- pflanzeit,
- pflanzdatum,
- bemerkung,
- erntedatum,
- bewertungvAndreas,
- bewertungvSahra,
- bewertungvBernd,
- bewertungvTom,
- bewertungvPeter,
- bewertungvIna,
- bewertungvJohn,
- bewertungvIrene
- ) VALUES (
- '$id',
- '$standort',
- '$pflanzeit',
- '$pflanzdatum',
- '$bemerkung',
- '$erntedatum',
- '$bewertungvAndreas',
- '$bewertungvSahra',
- '$bewertungvBernd',
- '$bewertungvTom',
- '$bewertungvPeter',
- '$bewertungvIna',
- '$bewertungvJohn',
- '$bewertungvIrene'
- )
- ");
- echo mysql_info();
- echo mysql_error();
- }
- $do = "SELECT * FROM `pfanzliste`.`pflanzliste`";
- $result = MYSQL_QUERY($do);
- function selectPflanzeit($pzeit) {
- switch ($pzeit) {
- case 'Vorfrucht':
- return "Vorfrucht";
- break;
- case 'Hauptfrucht':
- return "Hauptfrucht";
- break;
- case 'Zwischenfrucht':
- return "Zwischenfrucht";
- break;
- case 'Nachfrucht':
- return "Nachfrucht";
- break;
- default:
- return "Vorfrucht";
- break;
- }
- }
- function isVorfrucht($pzeit) { if(selectPflanzeit($pzeit) == "Vorfrucht") { return " selected "; } else { return ""; } }
- function isHauptfrucht($pzeit) { if(selectPflanzeit($pzeit) == "Hauptfrucht") { return " selected "; } else { return ""; } }
- function isZwischenfrucht($pzeit) { if(selectPflanzeit($pzeit) == "Zwischenfrucht") { return " selected "; } else { return ""; } }
- function isNachfrucht($pzeit) { if(selectPflanzeit($pzeit) == "Nachfrucht") { return " selected "; } else { return ""; } }
- function getPliste() {
- $sql = MYSQL_QUERY("SELECT name FROM lexicon.lex_name WHERE pflanze = '1'");
- echo mysql_error();
- return $sql;
- }
- function selectPflanze($db,$this) {
- $pliste = getPliste();
- while ($row = mysql_fetch_object($pliste)) {
- if($db == $row->name) {
- if($this == $row->name) return " selected ";
- else return "";
- break;
- }
- }
- }
- function selectPflanzenart($part) {
- switch ($part) {
- case 'Samen':
- return "Samen";
- break;
- case "Pflanze":
- return "Pflanze";
- break;
- default:
- return "Samen";
- break;
- }
- }
- function isSamen($part) { if(selectPflanzenart($part) == "Samen") { return " selected "; } else { return ""; } }
- function isPflanze($part) { if(selectPflanzenart($part) == "Pflanze") { return " selected "; } else { return ""; } }
- function is1($bw) { if($bw==1) { return " selected "; } else { return ""; } }
- function is2($bw) { if($bw==2) { return " selected "; } else { return ""; } }
- function is3($bw) { if($bw==3) { return " selected "; } else { return ""; } }
- function is4($bw) { if($bw==4) { return " selected "; } else { return ""; } }
- function is5($bw) { if($bw==5) { return " selected "; } else { return ""; } }
- ?>
- <!DOCTYPE HTML>
- <title>Pflanzliste</title>
- <meta charset="uft-8">
- <link rel="stylesheet" href="style.css">
- <div id="all">
- <?php
- $i = 0;
- while ($row = MYSQL_FETCH_ROW($result)) {
- if(!function_exists("generateSelectedPflanze")) {
- function generateSelectedPflanze($row) {
- $pliste = getPliste();
- $return = "";
- while($thisrow = mysql_fetch_object($pliste)) {
- $selectPflanze = selectPflanze($row[3], $thisrow->name);
- $name = $thisrow->name;
- $return .= '<option ' . $selectPflanze . '>' . $name . '</option>\n';
- }
- return $return;
- }
- }
- if(!function_exists("generateSelectedPflanzeLast")) {
- function generateSelectedPflanzeLast() {
- $pliste = getPliste();
- $return = "";
- while($thisrow = mysql_fetch_object($pliste)) {
- $name = $thisrow->name;
- $return .= '<option>' . $name . '</option>\n';
- }
- return $return;
- }
- }
- $i = $i + 1;
- echo '
- <form method="post" action="">
- <table class="tabelle">
- <tr>
- <td>Nummer</td>
- <td>Standort</td>
- <td>Pflanzeit</td>
- <td>Pflanzename</td>
- <td>Pflanzart</td>
- <td>Pflanz/Saat Datum</td>
- <td>Bemerkung</td>
- <td>Ernte Datum</td>
- <td>Bewertung</td>
- <td>Abschicken</td>
- </tr>
- <tr>
- <td data-type="id">
- ' . $row[0] .'
- <input type="hidden" name="id" value="' . $row[0] . '">
- </td>
- <td data-type="standort">
- <input type="text" name="standort" value="' . $row[1] .'">
- </td>
- <td data-type="pflanzeit">
- <select name="pflanzeit">
- <option ' . isVorfrucht($row[2]) . '>Vorfrucht</option>
- <option ' . isHauptfrucht($row[2]) . '>Hauptfrucht</option>
- <option ' . isZwischenfrucht($row[2]) . '>Zwischenfrucht</option>
- <option ' . isNachfrucht($row[2]) . '>Nachfrucht</option>
- </select>
- </td>
- <td data-type="pflanzname">
- <select name="pflanzname">
- ' . generateSelectedPflanze($row) .'
- </select>
- </td>
- <td data-type="pflanzart">
- <select name="planzart">
- <option ' . isSamen($row[4]) .'>Samen</option>
- <option ' . isPflanze($row[4]) .'>Pflanze</option>
- </select>
- </td>
- <td data-type="pflanzdatum">
- <input type="date" name="pflanzdatum" value="' . $row[5] .'">
- </td>
- <td data-type="bemerkung">
- <input type="text" name="bemerkung" value="' . $row[6] .'">
- </td>
- <td data-type="erntedatum">
- <input type="date" name="erntedatum" value="' . $row[7] .'">
- </td>
- <td data-type="bewertung">
- <table class="bw">
- <tr>
- <td>
- <select name="bewertungvAndreas">
- <option ' . is1($row[8]) . '>1</option>
- <option ' . is2($row[8]) . '>2</option>
- <option ' . is3($row[8]) . '>3</option>
- <option ' . is4($row[8]) . '>4</option>
- <option ' . is5($row[8]) . '>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvSahra">
- <option ' . is1($row[9]) . '>1</option>
- <option ' . is2($row[9]) . '>2</option>
- <option ' . is3($row[9]) . '>3</option>
- <option ' . is4($row[9]) . '>4</option>
- <option ' . is5($row[9]) . '>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvBernd">
- <option ' . is1($row[10]) . '>1</option>
- <option ' . is2($row[10]) . '>2</option>
- <option ' . is3($row[10]) . '>3</option>
- <option ' . is4($row[10]) . '>4</option>
- <option ' . is5($row[10]) . '>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvTom">
- <option ' . is1($row[11]) . '>1</option>
- <option ' . is2($row[11]) . '>2</option>
- <option ' . is3($row[11]) . '>3</option>
- <option ' . is4($row[11]) . '>4</option>
- <option ' . is5($row[11]) . '>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvPeter">
- <option ' . is1($row[12]) . '>1</option>
- <option ' . is2($row[12]) . '>2</option>
- <option ' . is3($row[12]) . '>3</option>
- <option ' . is4($row[12]) . '>4</option>
- <option ' . is5($row[12]) . '>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvIna">
- <option ' . is1($row[13]) . '>1</option>
- <option ' . is2($row[13]) . '>2</option>
- <option ' . is3($row[13]) . '>3</option>
- <option ' . is4($row[13]) . '>4</option>
- <option ' . is5($row[13]) . '>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvJohn">
- <option ' . is1($row[14]) . '>1</option>
- <option ' . is2($row[14]) . '>2</option>
- <option ' . is3($row[14]) . '>3</option>
- <option ' . is4($row[14]) . '>4</option>
- <option ' . is5($row[14]) . '>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvIrene">
- <option ' . is1($row[15]) . '>1</option>
- <option ' . is2($row[15]) . '>2</option>
- <option ' . is3($row[15]) . '>3</option>
- <option ' . is4($row[15]) . '>4</option>
- <option ' . is5($row[15]) . '>5</option>
- </select>
- </td>
- <tr>
- <tr>
- <td>Andreas</td>
- <td>Sahra</td>
- <td>Bernd</td>
- <td>Toni</td>
- <td>Peter</td>
- <td>Ina</td>
- <td>John</td>
- <td>Irene</td>
- </tr>
- </table>
- <br>
- </td>
- <td data-type="submit">
- <input type="submit" value="Abschicken">
- </td>
- </tr>
- </table>
- </form>
- ';
- }
- ?>
- <form method="post" action="">
- <input type="hidden" name="create">
- <table class="tabelle">
- <tr>
- <td>Nummer</td>
- <td>Standort</td>
- <td>Pflanzeit</td>
- <td>Pflanzename</td>
- <td>Pflanzart</td>
- <td>Pflanz/Saat Datum</td>
- <td>Bemerkung</td>
- <td>Ernte Datum</td>
- <td>Bewertung</td>
- <td>Abschicken</td>
- </tr>
- <tr>
- <td data-type="id">
- <?php echo($i+1); ?>
- <input type="hidden" name="id" value="">
- </td>
- <td data-type="standort">
- <input type="text" name="standort" value="">
- </td>
- <td data-type="pflanzeit">
- <select name="pflanzeit">
- <option>Vorfrucht</option>
- <option>Hauptfrucht</option>
- <option>Zwischenfrucht</option>
- <option>Nachfrucht</option>
- </select>
- </td>
- <td data-type="pflanzname">
- <select name="pflanzname">
- <?php echo generateSelectedPflanzeLast(); ?>
- </select>
- </td>
- <td data-type="pflanzart">
- <select name="planzart">
- <option>Samen</option>
- <option>Pflanze</option>
- </select>
- </td>
- <td data-type="pflanzdatum">
- <input type="date" name="pflanzdatum" value="">
- </td>
- <td data-type="bemerkung">
- <input type="text" name="bemerkung" value="">
- </td>
- <td data-type="erntedatum">
- <input type="date" name="erntedatum" value="">
- </td>
- <td data-type="bewertung">
- <table class="bw">
- <tr>
- <td>
- <select name="bewertungvAndreas">
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvSahra">
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvBernd">
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvTom">
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvPeter">
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvIna">
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvJohn">
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- </select>
- </td>
- <td>
- <select name="bewertungvIrene">
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- </select>
- </td>
- <tr>
- <tr>
- <td>Andreas</td>
- <td>Sahra</td>
- <td>Bernd</td>
- <td>Toni</td>
- <td>Peter</td>
- <td>Ina</td>
- <td>John</td>
- <td>Irene</td>
- </tr>
- </table>
- <br>
- </td>
- <td data-type="submit">
- <input type="submit" value="Abschicken">
- </td>
- </tr>
- </table>
- </form>
- </all>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement