29 lines
719 B
PHP
29 lines
719 B
PHP
<!-- Schreiben Sie ein Formular, in dem man eine Einkaufsliste erstellen kann. Verwenden Sie dafür Checkboxen im Formular, um auch gespeicherte Werte wieder löschen können: -->
|
|
|
|
<form action="" method="GET" >
|
|
|
|
<?php
|
|
$arr = array();
|
|
if(isset($_GET["arr"]))
|
|
$arr = $_GET["arr"];
|
|
|
|
if(isset($_GET["newValue"]))
|
|
{
|
|
$newValue = $_GET["newValue"];
|
|
|
|
if($newValue != "")
|
|
{
|
|
$arr[] = $newValue;
|
|
}
|
|
}
|
|
|
|
foreach($arr as $element)
|
|
{
|
|
echo "<input type=\"checkbox\" checked value=\"$element\" name=\"arr[]\">$element</input>";
|
|
echo "<br />";
|
|
}
|
|
?>
|
|
<input type="text" name="newValue" />
|
|
<br />
|
|
<input type="submit" />
|
|
</form>
|