I need to add items to my existing array through a form on the site i made. Basically once i submit something on my form it needs to add the item to the array, i can only use php and html for this problem.
i tried array_push but it doesnt give me what i need because it doesnt use the form
<form action="" method="post">
<input type="text" name="boodschappen"><br><br>
<input type="submit" value="Verstuur">
</form>
<ul>
<?php
$boodschappen = ["aardappelen","aardbeien","3 pakken melk","yoghurt"];
foreach ($boodschappen as $boodschap) {
echo "<li>".$boodschap."</li>";
}
?>
</ul>
</body>
</html>