Uebungsaufgaben_PHP_SS_25/test.php/index.php
2025-04-09 11:37:51 +02:00

58 lines
1.0 KiB
PHP

<?php
session_start();
?>
<form action="" method="get">
<label for="vorname">Vorname:</label>
<br/>
<input type="text" name="value[]" />
<br/>
<label for="nachname">Nachname:</label>
<br/>
<input type="text" name="value[]" />
<br/>
<label for="geburtsdatum">Geburtsdatum:</label>
<br/>
<input type="date" name="value[]" />
<br/>
<input type="submit" value="senden" />
</form>
<?php
$_SESSION["array"] = $_GET["value"];
$_SESSION["test"] = 15;
$irgendwas = $_SESSION["TollerWert"];
session_unset(); //
session_destroy();
$values = $_GET["value"];
echo "<p>";
print_r($values);
echo "</p>";
$arr = [12,12,12,[12,12,12],12, "Hallo!", 22.5];
$arr[2] = "Halsdfsfsflo";
$arr = 24;
$arr = array(12 => "Hallo", 17 => "Hey", "Hoh" => "Hi");
$arr["aaa"] = 123; //"aaa" => 123
echo $arr["Hoh"]; //-> Hi
//Ausgabe
print_r($arr);
//Ausgabe in einer Foreach-Schleife:
foreach($arr as $element )
echo "<p>".$element."</p>";
?>