Voll Upload SGD Fachinformatiker PHP

This commit is contained in:
2026-06-03 13:46:32 +00:00
parent 1256ec2190
commit 84a568d89c
265 changed files with 9961 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Einsendeaufgabe 1</title>
<?php
require("dynauswahl.php")
?>
</head>
<body>
<form method="post">
<p>
<?php echo dynAuswahl("dynamisch1", "auswahl1", array("Brot", "Butter", "Milch", "Eier", "Käse", "wurst"), false) ?>
</p>
<p>
<?php echo dynAuswahl("dynamisch2", "auswahl2", array("Schrauben", "Nägel", "Haken", "Nadeln", "Dübel"), true); ?>
</p>
<p>
<input type="submit" value="Abschicken">
</p>
</form>
</body>
</html>
+81
View File
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Einsendeaufgabe 2</title>
<?php
require("meinefunktionen.inc.php");
?>
</head>
<body>
<h1>Rechner</h1>
<?php
if(is_numeric($_POST["zahl1"]) && is_numeric($_POST["zahl2"])) {
if(isset($_POST["zahl1"])){
switch($_POST["operator"]){
case "+":
$ergebnis = addiere($_POST["zahl1"], $_POST["zahl2"]);
break;
case "-":
$ergebnis = subtrahiere($_POST["zahl1"], $_POST["zahl2"]);
break;
case "*":
$ergebnis = multipliziere($_POST["zahl1"], $_POST["zahl2"]);
break;
case "/":
$ergebnis = dividiere($_POST["zahl1"], $_POST["zahl2"]);
break;
default:
echo "<p><b>Bitte eine Rechenoperation angeben!</b></p>\n";
break;
}
}
}
else {
if(isset($_POST["zahl1"])){
echo "Bitte Nummern eingeben";
}
}
?>
<?php
if(isset($ergebnis)){
echo "<p><b> {$_POST["zahl1"]} {$_POST["operator"]} {$_POST["zahl2"]} = $ergebnis</b></p>\n";
}
?>
<form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post">
<p>
Bitte geben Sie in den Feldern die Daten ein:
</p>
<p>
<label for="zahl1">Zahl 1</label>
<input type="text" name="zahl1" id="zahl1" placeholder="Zahl 1" required autofocus>
</p>
<p>
<label for="zahl2">Zahl 2</label>
<input type="text" name="zahl2" id="zahl2" placeholder="Zahl 2" required>
</p>
<p>
<li><input type="radio" name="operator" id="addieren" value="+">
<label for="addieren">+</label></li>
<li><input type="radio" name="operator" id="subtrahieren" value="-">
<label for="subtrahieren">-</label></li>
<li><input type="radio" name="operator" id="multiplikation" value="*">
<label for="multiplikation">*</label></li>
<li><input type="radio" name="operator" id="division" value="/">
<label for="division">/</label></li>
</p>
<p>
<input type="submit" value="Berechnen">
<input type="reset" value="Zurücksetzen">
</p>
</form>
</body>
</html>
+48
View File
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Einsendeaufgabe 4</title>
<?php
require("berechnung.php");
require("setopt.php");
?>
</head>
<body>
<h1>Grundstückspreise</h1>
<?php berechnung() ?>
<fieldset>
<form method="post">
<p>
<label for="breite">Breite:</label>
<input type="text" name="breite" id="breite" placeholder="Breite?" required autofocus value="<?= htmlspecialchars($_POST['breite']) ?? '' ?>">
</p>
<p>
<label for="zahl2">Länge:</label>
<input type="text" name="laenge" id="laenge" placeholder="Länge?" required value="<?= htmlspecialchars($_POST['laenge']) ?? '' ?>">
</p>
<p>
<label for="pqm">Preis pro m²:</label>
<input type="text" name="pqm" id="pqm" placeholder="Preis / m²?" required value="<?= htmlspecialchars($_POST['pqm']) ?? '' ?>">
</p>
<p>
<label for="provision">Provisionssatz:</label>
<select name="provision" id="provision">
<?php setOption("0.03", "3");?>
<?php setOption("0.04", "4");?>
<?php setOption("0.05", "5");?>
<?php setOption("0.06", "6");?>
<?php setOption("0.07", "7");?>
</select>
</p>
<p>
<label for="mws">Mehrwertsteuer</label>
<input type="checkbox" name="mws" id="mws" value="0.19" <?= ($_POST['mws'] ?? '') == '0.19' ? 'checked' : '' ?>>
</p>
</fieldset>
<p>
<input type="submit" value="Berechnen">
</p>
</form>
</body>
</html>
+39
View File
@@ -0,0 +1,39 @@
<?php
require("meinefunktionen.inc.php");
function berechnung() {
if(isset($_POST["breite"])) {
if (is_numeric($_POST["breite"]) && is_numeric($_POST["laenge"]) && is_numeric($_POST["pqm"])){
$qm = multipliziere($_POST["breite"],$_POST["laenge"]);
$np = multipliziere($qm ,$_POST["pqm"]);
$prov = multipliziere($np, $_POST["provision"]);breite:
$nprov = addiere($np, $prov);
echo "\n\t<p>Breite: {$_POST["breite"]}m";
echo "\n\t<br>Länge: {$_POST["laenge"]}m";
echo "\n\t<br>Preis pro qm: {$_POST["pqm"]}";
echo "\n\t<br>Nettopreis: $np";
echo "\n\t<br>Nettopreis mit Provision: $nprov";
if (isset($_POST["mws"])) {
$bmws = multipliziere($nprov, $_POST["mws"]);
$brutto = addiere($nprov, $bmws);
echo "\n\t<br>Bruttopreis: $brutto €</p>";
}
else {
echo "</p>";
}
}
else {
echo "Bitte Zahlen eingeben";
}
}
}
?>
+31
View File
@@ -0,0 +1,31 @@
<?php
function dynAuswahl (string $id, string $name, array $options, bool $multiple) {
if ($multiple == 1) {
$multiple ="multiple";
}
switch($id){
case "dynamisch1":
echo"<select id='$id' name='$name' $multiple><br>";
foreach($options as $wert){
echo "\n\t\t\t\t\t<option value='$wert'>$wert</option><br>";
}
echo "\n\t\t\t\t</select>";
break;
case "dynamisch2":
echo"<select id='$id' name='$name' $multiple><br>";
foreach($options as $wert){
echo "\n\t\t\t\t\t<option value='$wert'>$wert</option><br>";
}
echo "\n\t\t\t\t</select>";
break;
}
}
?>
@@ -0,0 +1,26 @@
<?php
function addiere($summand1, $summand2){
return ($summand1 + $summand2);
}
function subtrahiere($minuend, $subtrahend) {
return ($minuend - $subtrahend);
}
function multipliziere($faktor1, $faktor2) {
return ($faktor1 * $faktor2);
}
function dividiere($dividend, $divisor) {
if ($divisor != 0) {
return ($dividend / $divisor);
}
}
?>
+20
View File
@@ -0,0 +1,20 @@
<?php
function setOption ($wert, $text){
$ausgabe = "<option value='{$wert}'";
if (isset($_POST["breite"])) {
if ($_POST["provision"] == $wert) {
$ausgabe .= " selected";
}
}
if(empty($text)) {
$text = $wert;
}
$ausgabe .= ">$text</option>\n";
echo $ausgabe;
}
?>